开发者

In Unix, how to create a file in a absolute path name

my variable p开发者_JAVA技巧ath1 contains the value /home/folder. how can I create a new file named foo using this absolute path name?

path1="/home/folder"
echo "hello web" > $path1/foo

but this code give me error. Can some one please tell me how can I create this file foo in a specific location, using a path name?


In bash you should write:

path1="/home/folder"; echo "hello web" > $path1/foo

Or:

export path1="/home/folder"
echo "hello web" > $path1/foo

Notation you used works only in bash script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜