I wish to execute some shell commands through PERL.
Here is what I desire to do
1) I wish to find list of directories in current working location
2) Then go in each directory and execute few commands like
a) rm -rf *.log (Shell command)
b) coreBuilder -f cb_tests.tcl (Some program Execution)
3) cd .. (come out of that dir)
Here is code writen by me
But it does not work. It does not go in directory, does not perform any job in the directory.
Thanks for your timely response.
Hardik
Last edited by pludi; 01-07-2010 at 03:46 AM..
Reason: code tags, please...
I wish to execute some shell commands through PERL.
Here is what I desire to do
1) I wish to find list of directories in current working location
2) Then go in each directory and execute few commands like
a) rm -rf *.log (Shell command)
b) coreBuilder -f cb_tests.tcl (Some program Execution)
3) cd .. (come out of that dir)
Here is code writen by me
But it does not work. It does not go in directory, does not perform any job in the directory.
Thanks for your timely response.
Hardik
Hello Since I do not see any other perl concepts in this, so why dont you go for a bash script rather than a perl?
Hi,
I have a shell script, In which i have variable "var1" and some perl command inside shell script.
export var1='coep -n rst-a2p-hinje.vci.all.com -c'
perl -pi -e 's/^/coep -n rst-a2p-hinje.vci.all.com -c /' command.txt
currently I am adding value of var1 in command.txt file by... (2 Replies)
Hi,
I would like to use a shell variable $amp in my perl command line.
for fa in $WORKSPACE/*.fa; do
amp=`grep ">.*" $fa | sed -e's#>\(.*\)#\1#g'`
ampsam="$WORKSPACE/$base/$base.$amp.sam"
sqheader=`grep "^@SQ.*SN:$amp.*" $sam`
printf "$sqheader\n" >> $ampsam
... (3 Replies)
Whenever the shell script is invoked by the scheduler the command execution return code is always captured as 0(Success).
If the same shell script is executed in command line via unix terminal, the command execution return code's are captured properly.
For example:
ls -ltr es_wrong_file ---->... (5 Replies)
Hi ,
I have a ps command inside perl script :
ps -ef | egrep tail_file.pl | egrep -v egrep | awk '{print $2}' | egrep $pid
through shell it's working fine . The same coammnd when executed through PERL , it'd displaying all the results
oracle 10141 1 0 2010 ? ... (5 Replies)
perl script i am using for search and replace is not working as expected...
I am using it for in-place search/replace.
I am new to perl, can someone please help me solving the issue here.
########SCRIPT
#!/bin/sh
var="abc"
var2="def"
perl -pi -e 's/${var}/def/g' testfile
exit 0
... (0 Replies)
Hi All,
I am using the following command to invoke the shell script from a perl command.
perl -i.bak -pe'BEGIN { $cmd = "/opt/coreservices/tomcat-5.5.9/bin/digest.sh -a sha"; }
s/(password=")(*)/
$1.`$cmd $2|cut -d: -f2|tr -d "\n"`
/e
' $CATALINA_HOME/conf/tomcat-users.xml
I need... (1 Reply)
Hello friends ,
I need a help how to call the variable which has define in the shell script in the perl command line.
example of the shell scrip :
str="hell0"
i want print the value of this variable in the perl command line.
perl -e 'print $str'
but this is not working .
can... (2 Replies)