Linux Shell脚本获取当前路径
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash

·
shell脚本获取当前路径
#方法一
#!/usr/bin/env bash
Cur_Dir=$(pwd)
echo $Cur_Dir
#方法二
#!/usr/bin/env bash
basedir=cd $(dirname $0); pwd -P
echo $basedir
其中,
dirname $0,取得当前执行的脚本文件的父目录
cd dirname $0
,进入这个目录(切换当前工作目录)
pwd,显示当前工作目录(cd执行后的)




A beautiful web dashboard for Linux
最近提交(Master分支:16 天前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前
更多推荐
所有评论(0)