Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: shell problem

by I0 (Priest)
on Aug 05, 2002 at 20:31 UTC ( #187809=note: print w/ replies, xml ) Need Help??

in reply to Trying to convert shell script to Perl

for $DIR (split/\s+/,`ls -d [a-k]* lts mon [n-z]*`){ if (-d "$DIR/bld"){ system (qq(cd $DIR/bld;cbsfpfg.exe `echo "cbs"$DIR$RELEASE $DI +R`)); } }
Update: added split to better emulate shell script

Comment on Re: shell problem
Download Code
Replies are listed 'Best First'.
Re: Re: shell problem
by graff (Chancellor) on Aug 06, 2002 at 03:01 UTC
    I don't think this approach will work any better than what the seeker posted. The problem is that the values being assigned to "$DIR" all have the line-termination character(s) attached (/[\r\n]+/), whereas this was not the case for the original shell script. You either have to "chomp $DIR" or else use the "opendir()" and "readdir()" calls, as demonstrated by DDA below.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://187809]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2015-11-29 14:42 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (751 votes), past polls