[ale] A bash question

Geoffrey lists at serioustechnology.com
Thu Sep 17 07:30:39 EDT 2009


Chuck Payne wrote:
> On Wed, Sep 16, 2009 at 6:50 PM, Tim Watts <timtw at earthlink.net> wrote:
>> The 2nd is more typical form. The 1st doesn't really work.
>>
>> What about using a symlink to one dir or the other?
>>
>>
>> On Wednesday 16 September 2009 6:06:53 pm Chuck Payne wrote:
>>> Guys,
>>>
>>> Sorry I am still a bit of NOOD on programmer and scripting. I have
>>> several boxes but a couple aren't SUSE, so iptables in not in
>>> /usr/sbin/iptables, I like to set up a VAR called $IPT can I do this,
>>> it a bash script...
>>>
>>> IPT=" if [ -e /sbin/iptables ] ; then
>>>               /usr/sbin/iptables
>>>               "
>>> Or
>>>
>>> if [ -e /sbin/iptables ] ; then
>>>           IPT="/sbin/iptables"
>>> else
>>>           IPT="/usr/sbin/iptables"
>>> fi
>>>
>>>
> I have used the second way, I thought there was a way to test and if
> it fail, you could use the other without else.

You could do something like:

test -e /sbin/iptables && IPT=/sbin/iptables || IPT=/usr/sbin/iptables


-- 
Until later, Geoffrey

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety.
  - Benjamin Franklin


More information about the Ale mailing list