Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shell: Tips #152

Open
xvno opened this issue Aug 7, 2021 · 1 comment
Open

Shell: Tips #152

xvno opened this issue Aug 7, 2021 · 1 comment

Comments

@xvno
Copy link
Owner

xvno commented Aug 7, 2021

Refs

@xvno
Copy link
Owner Author

xvno commented Aug 7, 2021

在 .sh 文件中获取该文件所在位置

通常用在以该 .sh 文件所在文件夹为工作目录的某些操作中

# file_dir=`cd $(dirname $0) && pwd`
file_path=$(dirname $0)
file_dir=$(cd $file_path && pwd)

# e.g.
cat $file_dir/mysql.env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant