bash命令用于创建自定义命名文件

时间:2021-08-01 23:28:32

Simple task probably buy I can not seem to find the command on http://faculty.plattsburgh.edu/jan.plaza/computing/help/commands.html

简单的任务可能买了我似乎无法找到http://faculty.plattsburgh.edu/jan.plaza/computing/help/commands.html上的命令

Basically I have a string of text that I know and have set in a variable on my bash file.

基本上我有一个我知道的文本字符串,并在我的bash文件中设置了一个变量。

I then need to save this text as a file called Foo.conf in desired directory.

然后,我需要将此文本保存为所需目录中名为Foo.conf的文件。

Here is what I have so far:

这是我到目前为止:

#!/bin/bash
stringForFile='port=6000 Username=USER Password=PASSWORD'
mkdir '~/.Foo'
# need to save file as Foo.conf to .Foo directory 

many thanks in advance

提前谢谢了

1 个解决方案

#1


1  

Why not use echo $stringForFile > ~/.Foo/Foo.conf after mkdir command?

为什么不在mkdir命令之后使用echo $ stringForFile>〜/ .Foo / Foo.conf?

#1


1  

Why not use echo $stringForFile > ~/.Foo/Foo.conf after mkdir command?

为什么不在mkdir命令之后使用echo $ stringForFile>〜/ .Foo / Foo.conf?