Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 23 Oct 2014, 04:48
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
redirection problems..
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
sc0ttman


Joined: 16 Sep 2009
Posts: 2385
Location: UK

PostPosted: Sun 24 Feb 2013, 05:13    Post subject:  redirection problems..
Subject description: bash version incompatibility..?
 

SOLVED: see last post

....


I tried Google.. now here.. I have this code, which works for me in bash-4.2.0:

Code:
cvlc "$FILE" vlc://quit &>>"$LOGFILE" &


The above runs VLC, outputting everything to $LOGFILE, and that is all run in the background, as the script it's inside then moves on to do stuff with the cvlc process..

Anyway... The code does not work (reportedly) in bash 3 .. apparently this does (a space before >>):

Code:
cvlc "$FILE" vlc://quit & >>"$LOGFILE" &


If I change &>> to just >>, then everything works fine, except the actual redirection that I want!

..

The code is loaded from within a func.. That func is not loaded as a background process.. But often that func is itself loaded inside another func which IS run as a background process ... As is, it all works for me..

I tried a few things, until it got messy and things got worse.. Any guidance on what's going on here would be greatly appreciated..

The relevant post is here, and originally reported a posts back from there: http://www.murga-linux.com/puppy/viewtopic.php?p=687378#687378

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search

Last edited by sc0ttman on Tue 26 Feb 2013, 09:10; edited 1 time in total
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2258

PostPosted: Sun 24 Feb 2013, 05:40    Post subject:  

Are you really wanting to *append* to the logfile? If not, then using '&>' would be correct and certainly works with bash-3.x
Back to top
View user's profile Send private message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2385
Location: UK

PostPosted: Sun 24 Feb 2013, 06:39    Post subject:  

I am indeed wanting to append.. But it's not essential.. Before this code I posted, the logfile is created with the actual VLC command and options printed at the top...

I am just hoping to make it work on both BASH versions, as well as I can..

I'd rather not have to have separate bits for different bash versions, so might drop the initial stuff added to the log file, and not append, as you suggest..

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2258

PostPosted: Sun 24 Feb 2013, 09:28    Post subject:  

I just checked and this works with bash-3.x:
Code:
cvlc "$FILE" vlc://quit 2>&1 1>>"$LOGFILE" &
Back to top
View user's profile Send private message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2385
Location: UK

PostPosted: Sun 24 Feb 2013, 12:55    Post subject:  

amigo wrote:
I just checked and this works with bash-3.x:
Code:
cvlc "$FILE" vlc://quit 2>&1 1>>"$LOGFILE" &

But it breaks the actual logging - with the above code, nothing is added to the logfile (in bash4 at least) .. I need logging to work for both bash 3 and bash 4..

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2258

PostPosted: Sun 24 Feb 2013, 13:00    Post subject:  

Try this:
Code:
cvlc "$FILE" vlc://quit 2>&1 |tee "$LOGFILE" &
Back to top
View user's profile Send private message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2385
Location: UK

PostPosted: Mon 25 Feb 2013, 08:52    Post subject:  

amigo wrote:
Try this:
Code:
cvlc "$FILE" vlc://quit 2>&1 |tee "$LOGFILE" &

Thanks again for the suggestion amigo.. Unfortunately, while this does fix the logging (somewhat, not including the first part, but thats fine..) but it breaks vlc-gtk, so that all cvlc processes go AWOL, and cannot be stopped, next'd, prev'd, etc.. they all play over each other, not replacing each other as before..

Damn, this is harder than I thought (I've also been trying my own stuff as well obv).. I might have to re-think how vlc-gtk all gets to that cvlc cmd in the first place, or get a totally new method of logging... I hope not..

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2258

PostPosted: Mon 25 Feb 2013, 13:22    Post subject:  

Is vlc-gtk a gtkdialog app, by chance?? If so, it should be no surprise that things go weird at times. Back up and try another tactic, if so. Or, maybe it needed to be backgrounded this way:
Code:
cvlc "$FILE" vlc://quit 2>&1 & |tee "$LOGFILE"
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Mon 25 Feb 2013, 20:36    Post subject:  

I've been meaning to patch gtkdialog to use the more portable async gio wrappers for popen. If there is any way you could boil it down to a simplified version, I'll take a look at it.
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2385
Location: UK

PostPosted: Tue 26 Feb 2013, 09:10    Post subject:  

SOLVED!

This is what works for me, using 2>>$LOGIFLE, not 1>> ...

Code:
cvlc "$FILE" vlc://quit 2>&1 2>>"$LOGFILE" &


The above code works in bash 3 and 4.. Thanks amigo!! Very Happy

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0666s ][ Queries: 12 (0.0041s) ][ GZIP on ]