Search Results

Search: Posts Made By: alt
5,679
Posted By alister
I agree. Your interpretation is faithful to the...
I agree. Your interpretation is faithful to the intent of the original version. The way the original code is written, it assumes export cannot fail.

Do I ever check export's return status? No...
5,679
Posted By Scrutinizer
But still then I am back to my original point and...
But still then I am back to my original point and that it is unlikely what the author intended, especially given the error message, so we better correct the author. BTW, do you ever check return...
5,679
Posted By alister
Hmmm. POSIX says export returns 0 and doesn't...
Hmmm. POSIX says export returns 0 and doesn't mention any possible error conditions. However, some shells' export builtin can return a non-zero status. Perhaps it's better to be safe than sorry...
5,679
Posted By alister
Hi, Scrutinizer: Your interpretation is...
Hi, Scrutinizer:

Your interpretation is indeed correct, but its correctness hinges on export always returning 0. I mentioned that not to nitpick, but as a heads up for newbies.

Regards,...
5,679
Posted By Scott
I certainly wouldn't challenge your assertion of...
I certainly wouldn't challenge your assertion of that. But I would challenge any assertion that said return codes are always meaningful:


/root # yum install jiggery-pokery
Loaded plugins:...
5,679
Posted By alister
Every single command run on a UNIX/Linux/POSIX...
Every single command run on a UNIX/Linux/POSIX system will return an exit status. If that exit status is 0, the shell treats that as a boolean true. Any other exit status is treated as a boolean...
5,679
Posted By ctsgnb
And which one is the best then ? (less parsing &...
And which one is the best then ? (less parsing & less resource consumming) ?
5,679
Posted By alister
A few alternatives: if [[ -f...
A few alternatives:

if [[ -f /sunstudio12/bin/sunf90 ]]; then
export IMDI_COMPILER=/sunstudio12/bin/sunf90
if [ $? -ne 0 ]; then
echo "Please specify location!"
exit
fi
...
5,679
Posted By ctsgnb
Now I agree with Dude Alister ... LoL
Now I agree with Dude Alister ... LoL
5,679
Posted By alister
That's close but not quite correct. The original...
That's close but not quite correct. The original version's echo executes if the export command fails. This interpretation's does not.

Regards,
Alister
5,679
Posted By methyl
Sorry, but this is absolute tosh. A Conditional...
Sorry, but this is absolute tosh. A Conditional Expression is not the same as a "test" and they have their own syntax and rules. Admittedly there is some small overlap in the syntax for certain...
5,679
Posted By DGPickett
[[ xxx ]] is test [ xxx ], see man test or test...
[[ xxx ]] is test [ xxx ], see man test or test in man ksh.

I call this "procedure as logic". Run the expresions and commands connected by && in order and keep going as long as commnads return...
5,679
Posted By ctsgnb
I agree with the dude Scrutinizer :)
I agree with the dude Scrutinizer :)
5,679
Posted By Scrutinizer
I think it is equivalent to this: if [...
I think it is equivalent to this:
if [ $COMPILER = "sun" ]; then
if [[ -f /sunstudio12/bin/sunf90 ]]; then
export IMDI_COMPILER=/sunstudio12/bin/sunf90
else
echo "Please specify...
5,679
Posted By ctsgnb
[[...]] && export... ||, is one line form of...
[[...]] && export... ||,

is one line form of

if [[ ... ]] ; then
export...
else
echo "Please ...
fi

the \ is used for cosmetic reasons : when a line is too long, you can break it by...
Showing results 1 to 15 of 15

 
All times are GMT -4. The time now is 01:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy