if the first command is executed successfully then execute the second command in linux
example
if the kuldeep folder is present at your working directory then this will create test.txt file in this folder.
[root@localhost~]#ls -ld kuldeep && touch kuldeep/test.txt
if the first command does not execute successfully then execute the second command in linux
example
if the kuldeep folder is not present at your working directory then this will create it
[root@localhost~]#ls -ld kuldeep || mkdir kuldeep
pls put your comments and suggestion.
example
if the kuldeep folder is present at your working directory then this will create test.txt file in this folder.
[root@localhost~]#ls -ld kuldeep && touch kuldeep/test.txt
if the first command does not execute successfully then execute the second command in linux
example
if the kuldeep folder is not present at your working directory then this will create it
[root@localhost~]#ls -ld kuldeep || mkdir kuldeep
pls put your comments and suggestion.
(y)
ReplyDeleteRight it working. Abhi check kr liya
ReplyDeleteFirtst commands execute nahi ho rahi.
ReplyDeleteSecond command ko execute karane ke baad first command execute ho rahi ha.
In my opinion jab hum first cmd ko first time execute Kara rahe hai toh uske 1st or 2nd part mein se koi bhi execute nahi ho raha because of && Gate/operator, 1st cmd ka 2nd part tab execute hoga jab 1st part true ho.
2nd cmd ko execute karne par uske 1st part ka error msg aata hai lekin fir bhi 2part execute ho jaata hai kyoki isme || gate/operator ka use kiya hai 1st condition false hone par bhi second condition execute ho rahi hai.