Re: Pipe Commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gopal Ghosh wrote:
Dear All,
my self gopal ghosh a newbie in Linux world. found myself in love with Linux as i came to know the power of Linux CLI

if two different commands are separated by || (a method by which two comands can be executed one after another )
such as
ls || nano

the above command executes both the command with out stops after executing the first one.

the book says that it will stop executing further after the first command
but it is not the same which i observed
pls help

'||' means 'or'. In a list of commands separated by '||', each of the commands are run until one of them succeeds.

as an example:
echo 1 || echo 2

this echoes '1' to the screen, but '2' is /not/ echoed.

in your command, 'nano' should only run if 'ls' fails.

for example, as a normal user, run this:
ls /root || nano

in that case, nano will run, but in this, it won't:
ls ~ || nano

I hope that helps!

kae

_______________________________________________
Fedora-laptop-list mailing list
Fedora-laptop-list@xxxxxxxxxx
http://www.redhat.com/mailman/listinfo/fedora-laptop-list

[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux