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
SFTP script issue sdhalepaska UNIX for Dummies Questions & Answers 0 07-05-2007 10:24 AM
Issue with a shell script vishalm Shell Programming and Scripting 4 12-23-2006 01:18 AM
Issue in my script chiru_h Shell Programming and Scripting 4 09-27-2006 06:27 AM
please help ftp script issue mgirinath Shell Programming and Scripting 4 04-28-2006 07:33 AM
Issue with sed in script bthomas Shell Programming and Scripting 3 04-14-2005 01:21 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-12-2008
Registered User
 

Join Date: Feb 2008
Posts: 35
script invokation issue

my problem is :

i have a small script automising the firefox invokation from my $HOME/bin
directory:
**********************
set FIREFOX_PATH='/tools/openbin/firefox/2.0.0.3/sparc-sun-solaris8'

set GTK_LIB_PATH='/tools/openbin/gtk+/1.2.10/sparc-sun-solaris8/lib'

set GLIB_LIB_PATH='/tools/openbin/glib/1.2.10/sparc-sun-solaris8/lib'


setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$FIREFOX_PATH;
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$GTK_LIB_PATH;
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$GLIB_LIB_PATH;

cd $FIREFOX_PATH
./firefox-bin &
cd
***********************
my question is

case:1
when i invoke the script sourcing it

source start_firefox.sh

it works
**********************
case:2

when i do from $hOME/bin

tcsh start_firefox.sh

.......it works
*******************
case:3

but when i do from $HOME/bin..here the script resides

./start_firefox.sh

error messages are coming like
*********
csbu061 [mhalder] 206: ./start_firefox.sh
./start_firefox.sh: setenv: not found
./start_firefox.sh: setenv: not found
./start_firefox.sh: setenv: not found
./start_firefox.sh: ./firefox-bin: not found
....i can understand its working while sourcing but i am confused why its working in the 2nd case while its not working in the 3 rd case

...please make me clear abt this
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-12-2008
Registered User
 

Join Date: Jun 2008
Location: Scotland
Posts: 86
setenv is a tcsh built-in command, so you can only run it in a shell.
In cae 1, source tells your current (tcsh) shell to interpret and execute the commands in the file.
In case 2, you are creating a new tcsh shell which interprets and executes the commands in the file.
In case 3, it is not clear what is supposed to interpret the commands in the file, so it looks like a default sh shell is created to run them. setenv does not exist in sh,, hence the error message.
Putting
Code:
#!/bin/tcsh
at the top of your file will solve this and is effectively the same as case 2.
Reply With Quote
  #3 (permalink)  
Old 06-12-2008
Registered User
 

Join Date: Feb 2008
Posts: 35
i tried that way but its not working ..
in my shell

csbu061 [mhalder] 277: cd /usr/bin
/usr/bin
csbu061 [mhalder] 278: ls | grep tcsh
tcsh

****my script after introducing the shebang line

#! /usr/bin/tcsh

set FIREFOX_PATH='/tools/openbin/firefox/2.0.0.3/sparc-sun-solaris8'

set GTK_LIB_PATH='/tools/openbin/gtk+/1.2.10/sparc-sun-solaris8/lib'

set GLIB_LIB_PATH='/tools/openbin/glib/1.2.10/sparc-sun-solaris8/lib'


setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$FIREFOX_PATH;
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$GTK_LIB_PATH;
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$GLIB_LIB_PATH;

cd $FIREFOX_PATH
./firefox-bin &
cd


*****
from the shell in $HOME/bin
csbu061 [mhalder] 117: pwd
/users/mhalder/bin

csbu061 [mhalder] 120: ls | grep 'start_a*'
start_firefox.sh
start_thunderbird.sh

csbu061 [mhalder] 152: ./start_firefox.sh
./start_firefox.sh: setenv: not found
./start_firefox.sh: setenv: not found
./start_firefox.sh: setenv: not found
./start_firefox.sh: ./firefox-bin: not found
csbu061 [mhalder] 153:
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 10:07 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