标签云

微信群

扫码加入我们

WeChat QR Code

在同一目录下创建文件夹作为shell脚本[复制]

This question already has an answer here:

I'm new to Shell Scripting:

I'm trying to create a script that asks for user input as to the folder name, finds the directory the script is being run from, and creates a folder within that same directory with a bunch of files (I can do that part)

My issue is I can't seem to figure out how to make the script find its current directory without explicitly spelling it out.

I want to be able to run it from anywhere and have it create the folder right next to it without the user having to path it from the home folder every time.

Could someone help with this?


Use $PWD or pwd. Start with echo $PWD or echo pwd

2018年06月18日02分27秒

Thank you. This worked really well.

2018年06月19日02分27秒