Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiline at command

Status
Not open for further replies.

nkm

Programmer
May 27, 2001
45
US
Hi

I am trying to execute this

at now + 1 minute <<!
echo &quot;hello&quot; >> /home/krishre/testat.out
echo &quot;there&quot; >> /home/krishre/testat.out
if [ $? -eq 0 ]; then
echo &quot;Its successfull&quot; >> /home/krishre/testat.out
else
echo &quot;It failed&quot; >> /home/krishre/testat.out
fi
!


Some how the if condition is not executing neither if nor else part is printed.

Can someone tell me why,
the other stmts(hello there) are printed fine

thanks
 
Hmm. I just copied and pasted it on to my system, changed the username, and it worked perfectly.

Annihilannic.
 
Hi

If I put the checking stmts into a file and invoke it it works fine. I am wondering the shell that at spawns while executing this stmts is not sh.

How can I check what shell is getting spawned
 
Put ps -fp $$ > somewhere in your at script, then look in the output file somewhere and it should give you an idea.

Annihilannic.
 
When calling the at command, use the -s parameter to force the use of /bin/sh. Similarly, you can use the -c and -k parameters to use /bin/csh and /bin/ksh, respectively.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top