1. Get the real path of the current script: #!/bin/bash if [[ $0 =~ ^\/.* ]] #Judge whether the current script is an absolute path, matching all thens starting with / script=$0 else script=$(pwd)/$0 fi script=`readlink -f $script` #Get the real path of the file script_path=${script%/*} #Get the directory where the file is located realpath=$(readlink -f $script_path) #Get the real path of the directory where the file is located echo $script echo $script_path echo $realpath 2.readlink -f: Get the real file location of the symbolic link, and finally get the real file location of the symbolic link 3.basename: Get the file name of the file 4.dirname: Get the directory name of the file Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links You may also be interested in:
|
<<: React example showing file upload progress
>>: Mysql delete duplicate data to keep the smallest id solution
Another important aspect of separating structure ...
Note: You cannot use scoped animations! ! ! ! via...
I can log in to MYSQL normally under the command ...
The growth path from a Linux novice to a Linux ma...
Preparation: 192.168.16.128 192.168.16.129 Two vi...
v-model is a Vue directive that provides two-way...
What is a profile? We can use it when we want to ...
Overview Prometheus is an open source service mon...
Table of contents Base Return Type String and Boo...
This article shares with you a detailed tutorial ...
The usage of H tags, especially h1, has always bee...
Introduction The use of is null, is not null, and...
MySQL v5.7.19 official version (32/64 bit install...
<br />In the previous article, I introduced ...
The event scheduler in MySQL, EVENT, is also call...