Questions tagged «bash»

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

5
加载共享库libSDL-1.2.so.0时出错
我正在尝试在ubuntu服务器上安装ioquake。 当我尝试运行它时,出现以下消息: # ./ioquake3 ./ioquake3.x86_64: error while loading shared libraries: libSDL-1.2.so.0: cannot open shared object file: No such file or directory 我以为我一切正常,这是libSDL所在的位置: # cd /usr/lib64 # /usr/lib64# ls -l total 2308 lrwxrwxrwx 1 root root 15 Oct 15 00:25 libSDL-1.1.so.0 -> libSDL-1.2.so.0 lrwxrwxrwx 1 root root 20 Oct 15 00:25 …



3
bash:将-x日志设置为文件
我有一个shell脚本,set -x具有详细/调试输出: #!/bin/bash set -x command1 command2 ... 输出看起来像这样: + command1 whatever output from command1 + command2 whatever output from command2 我的问题是,外壳输出(由set -x)前往stderr,用命令的输出(混合command1,command2...)。我很乐意在屏幕上显示“正常”输出(例如脚本woud在不使用的情况下运行set -x)和bash的“额外”输出分别存储在一个文件中。 所以我想在屏幕上显示这个: whatever output from command1 whatever output from command2 这在日志文件中: + command1 + command2 (如果日志文件包含所有内容,也可以) 该set -x 2> file明明好好尝试采取正确的效果,因为它不是set命令的输出,但它改变的bash的行为。 使用bash 2> file整个剧本还没有做正确的事,因为它重定向在这个shell中运行,以及每个命令的标准错误,所以我没有看到的命令的错误消息。

6
bash:别名:别名:找不到
登录时,我看到错误: bash:别名:别名:找不到 如果我是source我的.bashrc文件,该消息会再次出现。 是什么原因造成的?
18 bash  alias 

1
省略grep中的文件名
我正在从多个文件中提取一个字符串,但是一个不希望有的副作用是文件名在输出之前添加了前缀。如何仅使用grep抑制文件名输出? $ grep -i lp lpNet* lpNet:This was printed via the internet using the lp command. lpNet:I believe lp doesnt care what the device is. lpNet1:This was printed via the internet using the lp command. lpNet1:I believe lp doesnt care what the device is. lpNet2:This was printed via the internet …
18 command-line  bash  grep  cat 


1
su> echo“ <用户名>”是什么意思?
当我输入命令时 su &gt; echo "sachin" 它要求输入密码。当您输入密码时,您会看到一些奇怪的事情: 还有一件事:笔记本电脑上还有另一个用户Hadoop,但是当我这样做时 su &gt; echo "Hadoop" 它说 没有Hadoop的passwd条目 这是什么意思?


1
如何在bash提示中使用箭头符号?
如何在bash提示中使用这些红色和绿色箭头标志? 更新1 这是我的.bashrc档案 if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[\033[00m\]\ [\033[01;34m\]→ \w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}→ \w\$ ' fi unset color_prompt force_color_prompt 我希望此箭头的颜色为@dessert之前回答的颜色(将红色和绿色表示为false和true命令)
17 bash  bashrc  prompt 



1
bash为什么认为010是8?
bash为什么认为数字010 = 8? x=010 echo $x 010 echo $(( x+0 )) 8 echo $(( x-2 )) 6 我认为它可能是二进制的,但是010 = 10 =2。那么为什么它得到8,又如何使它认为010 = 10(和010-2 = 8)?
17 bash 

9
在输出文件中包含命令?
抱歉,标题令人迷惑! 假设我跑步 apt-cache depends kde-window-manager &gt; ~/Desktop/kwin-depends 我将在“桌面”文件夹中得到一个名为“ kwin-depends”的文件。 是否有一些技巧可以将我发出的命令作为文件的一部分包括在内,最好在文件的开头? 因此,至少在14.04 LTS中,前几行如下所示: apt-cache depends kde-window-manager &gt; ~/Desktop/kwin-depends kde-window-manager Depends: kde-runtime Depends: libc6 |Depends: libegl1-mesa Depends: &lt;libegl1-x11&gt; 而不是像这样: kde-window-manager Depends: kde-runtime Depends: libc6 |Depends: libegl1-mesa Depends: &lt;libegl1-x11&gt;


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.