Path Error in script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Path Error in script
# 1  
Old 02-09-2012
Path Error in script

Hi All,

I copied an existing script so that I could make updates to it and test those updates.

In both scripts I set the path which is the exact same in both scripts as I copied from the old to the new script.

setting path is this command:
Code:
# Add the path required for EMC commands to run correctly
export PATH=$PATH://usr/bin:/etc:/usr/sbin:/usr/local/bin:/usr/symcli/bin:/usr/emc/scripts:/usr/sbin

In the old script there is absolutely no problem with this path setting whether you run it manually or via the crontab.

In the old script when it runs the path settings I get the following output:
Code:
$ sudo ./DAILYCHECKS.VMAX.sh.old.08022012
+ export PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/isoscwi/bin:/usr/bin/X11:/sbin:.:/usr/local/bin:/usr/symcli/bin:/usr/emc/scripts:/usr/sbin://usr/bin:/etc:/usr/sbin:/usr/local/bin:/usr/symcli/bin:/usr/emc/scripts:/usr/sbin

In the NEW script when it runs the path settings I get the following output:
Code:
$ sudo ./DAILYCHECKS.VMAX.sh
./DAILYCHECKS.VMAX.sh: ukaixtsm001:/home/isoscwi/CAPACITY: not found
+ export PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/isoscwi/bin:/usr/bin/X11:/sbin:.:/usr/local/bin:/usr/symcli/bin:/usr/emc/scripts:/usr/sbin://usr/bin:/etc:/usr/sbin:/usr/local/bin:/usr/symcli/bin:/usr/emc/scripts:/usr/sbin
./DAILYCHECKS.VMAX.sh: PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/isoscwi/bin:/usr/bin/X11:/sbin:.:/usr/local/bin:/usr/symcli/bin:/usr/emc/scripts:/usr/sbin://usr/bin:/etc:/usr/sbin:/usr/local/bin:/usr/symcli/bin:/usr/emc/scripts:/usr/sbin: is not an identifier

I am a bit confused as to what is going on here, like I said this bit has remained untouched and it is being run from exactly the same place as the old one.

One other thing to add, when I am testing, I have # the export command out while using the sudo ./<script> and it works. I added it into the crontab last night and it ran through but was unable to run any of the commands, which I assume at the moment is because it did not have the PATH set.

Any suggestions on what I might be missing here?

Col
# 2  
Old 02-09-2012
What shell are you using? Are you setting it explicitly in the shebang of your script? If not perhaps the default shell differs or the /bin/sh of the two systems are not equal?
In old shells you had to assign the variable first and then export:
Code:
PATH=/blabla:/blabl/gr
export PATH

Are you on Solaris maybe? /bin/sh there is pretty old. Alternatively use /usr/xpg4/bin/sh


BTW: better not put a dot in your PATH..
This User Gave Thanks to Scrutinizer For This Post:
# 3  
Old 02-09-2012
Check whether the shell is same.
one thing you can try is instead of "export" try with "set"

---------- Post updated at 03:44 AM ---------- Previous update was at 03:44 AM ----------

Check whether the shell is same.
one thing you can try is instead of "export" try with "set"/"setenv" if it is csh

Last edited by kalpeer; 02-09-2012 at 07:50 AM..
This User Gave Thanks to kalpeer For This Post:
# 4  
Old 02-09-2012
The first error looks like a piece of bad code, possibly as a result of editing with a Microsoft editor such as Notepad. We'd need to see the script with bad characters made visible:
Code:
sed -n l DAILYCHECKS.VMAX.sh

The second error "is not an identifier" comes from an original Bourne Shell. The "export" command was not available in that Shell.
As Scrutinzer implies, you probably need a shebang line at the top of the script to invoke the correct Shell.

If the two scripts are similar, try looking at the differences:
Code:
diff DAILYCHECKS.VMAX.sh DAILYCHECKS.VMAX.sh.old.08022012

This User Gave Thanks to methyl For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Command to see the logical volume path, device mapper path and its corresponding dm device path

Currently I am using this laborious command lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}' Would like to know if there is any shorter method to get this mapping of... (2 Replies)
Discussion started by: royalibrahim
2 Replies

2. Shell Programming and Scripting

Error when using certain directory path

Hi, I am using the following code to check if directory is empty: if ; then echo "There is no files in the input" sleep 60 fi And indir path is: /CH_ROOT/PRD/MAIN/INPUT/SDNTL/Interconnect Only when I am using the above path I get an error "too many arguments". I tried with 10... (4 Replies)
Discussion started by: apenkov
4 Replies

3. UNIX for Dummies Questions & Answers

$PATH error (possibly)

Upon opening Terminal I get the following message: -bash: /usr/bin/manpath: No such file or directory -bash: /usr/bin/perl: No such file or directory -bash: grep: command not found -bash: grep: command not found -bash: grep: command not found -bash: grep: command not found I searched... (9 Replies)
Discussion started by: SartreSmartre
9 Replies

4. Solaris

useradd: ERROR: Path must not start with '/home/'.

root@solaris11express:/home# useradd -d /home/oracle oracle UX: useradd: ERROR: Path must not start with '/home/'. and the user oracle is not being created... (2 Replies)
Discussion started by: kompcouk
2 Replies

5. Solaris

configure: error: no acceptable ld found in $PATH

When i configure apache(2.2.15) on solaris-8 server it producing following error <configure: error: no acceptable ld found in $PATH configure failed for srclib/apr > please help me any to fix this error. :confused: ---------- Post updated at 09:44 PM ---------- Previous update was... (0 Replies)
Discussion started by: kalpeer
0 Replies

6. Shell Programming and Scripting

absolute path for a script ran with relative path

I have a script in which i want to print absolute path of the same script irrespective of path from where i run script. I am using test.sh: echo "pwd : `pwd`" echo "script name: $0" echo "dirname: `dirname $0`" when i run script from /my/test/dir/struct as ../test.sh the output i... (10 Replies)
Discussion started by: rss67
10 Replies

7. Shell Programming and Scripting

Script Path Help

I have the following paths in a flat file /app00/app/mdbsorap/oradata/mfprd/system01.dbf /app00/app/mdbsorap/oradata/mfprd/system02.dbf /app00/app/mdbsorap/oradata/mfprd/system03.dbf /app00/app/mdbsorap/oradata/mfprd/system04.dbf /app00/app/mdbsorap/oradata/mfprd/system05.dbf what i would... (2 Replies)
Discussion started by: gseptember
2 Replies

8. Shell Programming and Scripting

error in script path for tablespace usage

Hi , I am trying to run this script in crontab but I get errors. When I run it explicitly like ./monitor_tblsp from another location then it runs fine . I am messing somewhere with paths but I don't know where and how . Please help . Here is the error part ./monitor_tblsp: touch: not... (2 Replies)
Discussion started by: capri_drm
2 Replies

9. Shell Programming and Scripting

Maintain full path of a script in a var when sourcing it from a different script

Hi All, I've searched through the forum for a solution to this problem, but I haven't found anything. I have 2 script files that are in different directories. My first script, let's call it "/one/two/a.sh" looks like this: #!/bin/sh IN_DIR=`dirname $0` CUR_DIR=`pwd` cd $IN_DIR... (4 Replies)
Discussion started by: mrbluegreen
4 Replies

10. HP-UX

URGENT: UNIX FTP cannot find path error

Dear all We are currently working on to install some ERP system in wjhich we need to FTP from unix to windows 2000 machine We run ./lodrun to get files from d/xxxxx/xxxx directory but the ftpoutput.log file shows following error FTP: xxxxxxxxx system cannot find the path specified... (1 Reply)
Discussion started by: minix
1 Replies
Login or Register to Ask a Question