0
路径获取文件在我的蟒蛇cwd
我可以这样做:如何加入shell脚本
import os
cwd = os.getcwd()
filename = 'file.txt'
path = os.path.join(cwd, filename)
我怎么会做相同的shell脚本?
路径获取文件在我的蟒蛇cwd
我可以这样做:如何加入shell脚本
import os
cwd = os.getcwd()
filename = 'file.txt'
path = os.path.join(cwd, filename)
我怎么会做相同的shell脚本?
当前工作目录可以在bash中用命令pwd
获得。
通常,变量$PWD
包含该目录。所以,这样的事情应该做的:
full_path="${PWD}/foo.txt"
,并通过调用pwd
命令:
full_path="$(pwd)/foo.txt"
怎么也[让你的工作目录(http://stackoverflow.com/questions/8635456/how尚北道任您得到最电流的工作目录,在-的bash) – CoryKramer 2014-09-29 21:00:18