On Tue, 9 Feb 2016 09:01:28 -0600, John McKown wrote: >On Tue, Feb 9, 2016 at 8:51 AM, David Magee wrote: > >> Kirk, >> >> My .profile is >> >> umask 027 >> Sys_MPT=$(sysvar SYSNAME) >> echo $Sys_MPT >> echo $HOME/$Sys_MPT/maxdate >> if [ ! -f $HOME/$Sys_MPT/maxdate ]; then >> /usr/sbin/mount -v -f UNIX.ZFS.QRDR.C2ECQRLF.$Sys_MPT ./$Sys_MPT >> echo "* The QRadar LEEF file was NOT mounted. *" >> echo "* A mount command has been issued. *" >> else >> echo "* The QRadar LEEF file was ALREADY mounted. *" >> fi >> >> The echo's in STDOUT are: >> >> SYSQ >> /u/c2ecqrlf/SYSQ/maxdate >> * The QRadar LEEF file was ALREADY mounted. * >> >> But STDERR is showing >> >> [: /u/c2ecqrlf/.profile 5: FSUM7351 not found >> >> and the mount was NOT performed. >> >> Something must not be right with my if statement. The if statement works >> when variables are not in the statement. >> This seems to be reporting that "[" is not found. What does "type [" report? (Add that for diagnosis to your script.) How is "[" defined? Is it an alias for "test"? Is it a link to "test"? Other?
>The first thing that I do when a script is not working correctly is make >the first statement be: > >set -x > >this will echo each statement to stdout just before it is executed. It >helps me get a better idea what is going on. > And a point of style: I find "if" constructs more legible if, ceteris paribus, I code the shorter branch first. -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
