开发者

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

开发者 https://www.devze.com 2023-01-24 22:45 出处:网络
my variable p开发者_JAVA技巧ath1 contains the value /home/folder. how can I create a new file named foo using this 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

精彩评论

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

关注公众号