当前位置:网站首页>In shell programming, the shell file with relative path is referenced
In shell programming, the shell file with relative path is referenced
2022-04-23 18:14:00 【The hunter is eating meat】
There are two in the same directory shell file : xxutil.sh、main.sh.
Under normal circumstances main.sh Use in xxutil.sh The contents are as follows :
main.sh :
source ./xxutil.sh
# ...
# ...
perform command sh main.sh
, normal , No problem .
however , If In other directories , Use absolute commands perform main.sh
when , Will throw out : Can't find xxutil.sh Errors in documents .
The solution is as follows :
DIRNAME=$0
if [ "${DIRNAME:0:1}" = "/" ];then
CURDIR=`dirname $DIRNAME`
else
CURDIR="`pwd`"/"`dirname $DIRNAME`"
fi
#echo $CURDIR
source $CURDIR/xxutil.sh
版权声明
本文为[The hunter is eating meat]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210611118177.html
边栏推荐
- Random number generation of C #
- journal
- Rust: shared variable in thread pool
- Docker installation MySQL
- Spark performance optimization guide
- Cygwin64 right click to add menu, and open cygwin64 here
- Docker 安裝 Redis
- Romance in C language
- Analysez l'objet promise avec le noyau dur (Connaissez - vous les sept API communes obligatoires et les sept questions clés?)
- proxy server
猜你喜欢
Docker 安裝 Redis
Batch export ArcGIS attribute table
Docker 安装 MySQL
Docker installation MySQL
A few lines of code teach you to crawl lol skin pictures
Nodejs安装
Vulnérabilité d'exécution de la commande de fond du panneau de commande JD - freefuck
From source code to executable file
positioner
深度学习经典网络解析目标检测篇(一):R-CNN
随机推荐
Nanotechnology + AI enabled proteomics | Luomi life technology completed nearly ten million US dollars of financing
[UDS unified diagnostic service] v. diagnostic application example: Flash bootloader
Rust: shared variable in thread pool
Reptile efficiency improvement method
Deep learning classic network analysis and target detection (I): r-cnn
Yolov4 pruning [with code]
Robocode tutorial 7 - Radar locking
Feign requests the log to be printed uniformly
Gobang game based on pyGame Library
函数递归以及趣味问题的解决
【ACM】509. Fibonacci number (DP Trilogy)
Crawl the product data of Xiaomi Youpin app
硬核解析Promise对象(这七个必会的常用API和七个关键问题你都了解吗?)
【ACM】509. 斐波那契数(dp五部曲)
[UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (2)
Qtablewidget usage explanation
Install the yapiupload plug-in in idea and upload the API interface to the Yapi document
[UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (1)
Flash - Middleware
多功能工具箱微信小程序源码