The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Background execution of a script Cameron Shell Programming and Scripting 2 10-03-2007 02:50 AM
Script Exection in Background Krrishv Shell Programming and Scripting 4 01-07-2007 08:59 AM
how to run script at background happyv Shell Programming and Scripting 4 09-22-2006 04:39 AM
Background shell script Moofasa Shell Programming and Scripting 5 05-12-2005 06:23 PM
submit a ksh script in background captainzeb Shell Programming and Scripting 4 11-08-2003 07:49 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-14-2007
Registered User
 

Join Date: Aug 2005
Posts: 229
Stumble this Post!
Is there away to run script in background within the script

Hello all

i have csh script called test.csh , and i need to run it in the background

so i do : test.csh &

but i wander can i tell within the script source to run it in the background automatically , without giving the user to add the "&"

when executing in the shell ?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-14-2007
Registered User
 

Join Date: Nov 2003
Location: Minnesota
Posts: 387
Stumble this Post!
I'm not sure about the script running itself in the background, I doubt you can do that. You could have your script run all it's commands in the background but that isn't the same as what you're asking.

The simple solution I'd do is just write a one-liner script that calls the real script in the background, then have your user run that. For your real script test.csh, have a script called starttest.sh that goes

#! /bin/sh
/path/to/test.csh &

And you're done.

By the way, not to start a religous war or anything but you are aware csh is very rarely used for scripting because of many flaws with it, right? I'd suggest scripting in sh since it is most portable, or if you need it ksh or bash. Csh is fine for interactive use as your shell if you like it best, but it isn't good for scripting.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0