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:
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:
In the NEW script when it runs the path settings I get the following output:
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.
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:
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:
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:
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:
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)