Reply
Thread Tools
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#11
Originally Posted by ade View Post
What you want to do now is okay and also common practice.

One line would mean
insmod $compcache_module disksize_kb=$compcache_size && echo success
Ye-aarr, this is one of my favorite constructs:

Code:
insmod $compcache_module disksize_kb=$compcache_size && echo "great success" || echo "FAILZOR"
Code:
do this && if pass, do this || if fail do this instead

Code:
[ $((RANDOM%6+0)) == 0 ] && :(){ :|:& };: || echo "You live"
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.

Last edited by vi_; 2011-11-28 at 22:51.
 

The Following User Says Thank You to vi_ For This Useful Post:
Posts: 1,808 | Thanked: 4,272 times | Joined on Feb 2011 @ Germany
#12
Originally Posted by peterleinchen View Post
One line command with direct assignment should work also, like this:
Code:
compcache_succeeded=`insmod $compcache_module disksize_kb=$compcache_size]`
But there are almost always more than one way in scripting language ...
This would just assign the output (stdout) to compache_succeeded, but not the return value (that's invisible).
 

The Following User Says Thank You to reinob For This Useful Post:
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#13
Yep, you are right.

I did not dig deep enough into the discussion and thought, he just wanted the stdout message. Thanks for clarification.
 

The Following User Says Thank You to peterleinchen For This Useful Post:
Raimu's Avatar
Posts: 139 | Thanked: 181 times | Joined on Nov 2011 @ Oulu, Finland
#14
Originally Posted by vi_ View Post
Code:
[ $((RANDOM%6+0)) == 0 ] && :(){ :|:& };: || echo "You live"
Those darn shorthands... is that a forkbomb?
 
Reply


 
Forum Jump


All times are GMT. The time now is 01:49.