Im unable to run scripts when i read each script thru a while loop. Is this way of execution thru while loop is wrong or is there any error in the script.
I get the following error msg and i use ksh.
contents of variable SCRIPT_LIST are
You get this error because you're passing the entire record as a single argument.
If the script names do not contain white spaces or other pathological characters, you could use eval, but it could be dangerous, because it will try to execute whatever string you pass to it:
Another option is to assign the words (script name, options and arguments) to a different variables, something like:
Because shell word splitting occurs before variable expansion, when you run the script like this:
the shell tries to execute the following command:
So the shell is looking for a command named add.ksh -customer 4875 ..., not for command/script named add.ksh.
The argument passed to eval is evaluated twice, in your case first the variable is expanded, than the ordinary processing is attempted: redirection, shell word splitting, variable expansion (if any variable is left) etc, so the shell sees the correct command and executes it.
As I said, it would be safer to use the second approach.
Thanks much. I could use your 2nd option but the each scripts im running in the bg has different number of arguments to be passed. i.e other than these arguments
to the script there are other diff types of arguments/parameters need to be passed. Guess i could use $* in while loop to this approach.
I have this doubt: if im able to run the series of jobs in bg how can i confirm that all these series of jobs are running "only in bg" why because all these jobs are called thru the parent script
Hence i guess there would be only one PID generated for this parent-script alone and not for the other scripts/jobs running inside the parent script.Pls advise.
Thanks much. I could use your 2nd option but the each scripts im running in the bg has different number of arguments to be passed. i.e other than these arguments
to the script there are other diff types of arguments/parameters need to be passed. Guess i could use $* in while loop to this approach.
You could use something like this (untested):
Quote:
I have this doubt: if im able to run the series of jobs in bg how can i confirm that all these series of jobs are running "only in bg" why because all these jobs are called thru the parent script
Hence i guess there would be only one PID generated for this parent-script alone and not for the other scripts/jobs running inside the parent script.Pls advise.
I'm not sure I understand. If you need the pids of the background jobs:
In my 1st post i have this script
where when this script is run it runs the other scripts thru the while loop in background.These other scripts (or the list of scripts to be run) are present in variable SCRIPT_LIST.How can we find the pid's of these other scripts.
Hi,
I wrote this script to test if the output for DIR1 and DIR2 comes out as I want :
#!/bin/bash
DAY=$(date +%d)
MONTH=$(date +%b)
YEAR=$(date +%Y)
DIR1=$($MONTH$YEAR"_Blast_BC01")
DIR2=$($MONTH$YEAR"_Blast_BC15")
echo $DIR1
echo $DIR2
This is the output I want for echo $DIR1 ... (12 Replies)
I have the following script test.sh owned by dwdev account and group dwdev, the permissions on the script are as follows.
-rw-r-x--- 1 dwdev dwdev 279 Sep 17 13:19 test.sh
Groups:
cat /etc/group | grep dwdev
dwdev:x:704:dwdev
dwgroup:x:725:dwdev
writers:x:726:dwdev
User:
cat /etc/passwd |... (3 Replies)
I am facing this weird issue where the script is working fine from the command line but when I am executing it from cron though it is working fine but the "if" loop is processing else part though I know that the if part of the logic is true and ideally the loop should execute the if portion.
... (3 Replies)
Hi
Please assist. Im getting an error while execuing the script name d "cdsnd.basel.cd_new
" as siiadm user. Thanks.
siiadm> ls -l
total 64
-rwxr-xr-x 1 siiadm sboadm 1004 Sep 17 2008 cdsnd.basel.cd
-rwxr-xr-x 1 siiadm sapsys 998 Nov 16 09:14 cdsnd.basel.cd_new... (1 Reply)
Hi ,
I m getting an error after executing the script.
My script.
Script is used to find out the date on 8 different machines(mentioned in SERVERNAMES file).
I have added public key to avoid ssh password and ssh without password working fine.
#!/bin/sh
fn_VMFind()
{
Date=`ssh -t... (5 Replies)
I am executing the below in telnet
#!/usr/bin/ksh
File1=simple.txt # The file to check
LogFile=simple.log # The log file
DelayMax=30 # Timeout delay
Tolerance=2
# BEGIN ##############################
while true
do
StampNow=$(date +%s)/60 # stamp in minutes
... (3 Replies)
Hello
I am executing the following script
nawk 'NR == 1 || substr($0,63,5) ~ /H... / && \
_++ == 2 { fn && close(fn); fn = "part_" ++c; _ = 1 }
{ print > fn }' sample.dat
When i execute as it is it is executing fine. but when i execute the whole script as a single line like below
... (2 Replies)
I have a server that receives backup files from several servers. Each server has its own directory to scp their files into, some of the files are received as .tar files and need to be compressed before being dumped. When the scp of the tar file is complete a file named 'flag' is also sent to... (2 Replies)