Linux Command Success or not
root@mariadbcluster-0:/# ls
bin data dev home lib64 media opt root run.sh srv tmp var
boot db etc lib mariadbcluster mnt proc run sbin sys usr
A failed test
root@mariadbcluster-0:/# ls |grep aa
root@mariadbcluster-0:/# res=$?
root@mariadbcluster-0:/# echo $res
1
A Success test
root@mariadbcluster-0:/# ls |grep mnt
mnt
root@mariadbcluster-0:/# res=$?
root@mariadbcluster-0:/# echo $res
0
The res =0
is success and =1
is failed.
where $?
is get the previous result.
No comments:
Post a Comment