how to know whether a directory existing in my ubuntu
程序员文章站
2023-12-30 17:05:34
...
if you want to test a directory whether existing in your ubuntu computer
1:test -d /home
2:echo $?
if the answer is 0,it means that this directory exists.
if other number,you can know that your computer doesn't have the directory
if you want to create a new directory, you can do like this
sudo mkdir /var/my_sql_back
if you want to see if you are the root user
you can use this command
echo $UID
# if the result is 0, you are the superuser
# if not,you are not the superuser
#also you can do like this
echo $USER
#it will tell you that who you are ,if the result is root
#your computer are in superuser mode
#if not,you are now in the common mode