Questions tagged «bash»

Bash(Bourne-Again SHell)是默认情况下在Ubuntu命令行界面中使用的shell。

1
在sh模式下执行脚本,而不是在Shell中执行bash
我将我的脚本添加mylovelyscript.sh到/bin/文件夹中。我的脚本包含echo使用不同文本颜色显示文本的代码。但是当我运行脚本时 $ mylovelyscript 它以bash模式执行。因此,我的脚本给出了带有颜色代码的文本的输出,例如 \e[93mHello World! 但没有彩色文字。但是,当我像$ sh mylovelyscript.sh使用sh命令一样运行脚本时,它会按照我想要的方式执行。现在,我希望我的脚本给我像sh模式一样的彩色文本,但是在这种情况下,我想将我的脚本称为$ mylovelyscript,而不是$ sh mylovelyscript。我该怎么做?谢谢!

3
“边读边”粘贴问题
我有69个名为的文件*.sites.pi。例如,OC9.sites.pi,cu27.sites.pi等。 每个文件的前缀(位于.sites.pi之前)位于名为的文件中ind_list。 $ cat ind_list OC9 Ocu27 ... 我想将所有这些文件的第三列合并在一起。 我试过了 : while read i do paste <(cut -f3 $i.sites.pi) >> output done < ind_list 但这是行不通的。我该如何运作?
bash  paste 

1
无法找到软件包openfoam221
当我执行命令时 **VERS=$(lsb_release -cs) sudo sh -c "echo deb http://www.openfoam.org/download/ubuntu $VERS main > /etc/apt**/sources.list.d/openfoam.list"*][1]* 我有一个文件,openfoam.list 但输出sudo apt-get install openfoam221 是 N: Ignoring file 'openfoam221_0-1_i386.deb' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension N: Ignoring file 'openfoamlist' in directory '/etc/apt/sources.list.d/' as it has no filename extension N: Ignoring file 'openfoam221_0-1_i386.deb' …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.