我对这个cut命令没有异议。
wolf@linux:~$ echo ab cd ef
ab cd ef
wolf@linux:~$ echo ab cd ef | cut -d ' ' -f 1
ab
wolf@linux:~$ echo ab cd ef | cut -d ' ' -f 2
cd
但是,当我尝试使用这样的不同输入的相同命令时,我没有得到预期的输出。
wolf@linux:~$ ip address show eth0 | grep 'inet '
inet 10.10.10.10/24 brd 10.10.10.25
我已经编写了shell脚本,它从输入文件中读取命令并执行命令。我有这样的命令:
cat linux_unit_test_commands | grep "dmesg"
在输入文件中。在执行shell脚本时,我收到下面的错误消息:
cat: |: No such file or directory
cat: grep: No such file or directory
cat: "dmesg": No such file or directory
剧本:
#!/bin/bash
while read line
do
output=`$line
为什么
grep e\\.g\\. <<< "this is an e.g. wow"
和
grep e\.g\. <<< "this is an e.g. wow"
做同样的事?
如果我加上第三个斜杠,它也有相同的结果。但是,一旦我加了第四个斜杠,它就不再起作用了。这与一堂课的旧考试中的一题有关。它问一个有两个反斜杠的人是否会用“例如”来输出这一行。我一开始以为它行不通,但我试着确保它成功了。原因是什么?
# ldd /usr/bin/ffmpeg
linux-vdso.so.1 => (0x00007ffffc1fe000)
libavfilter.so.0 => not found
libpostproc.so.51 => not found
libswscale.so.0 => not found
libavdevice.so.52 => not found
libavformat.so.52 => not found
libavcodec.so.52 => not found
li
在这两个for语句中,我都得到了以下错误:
./count_files.sh: line 21: [: too many arguments
./count_files.sh: line 16: [: too many arguments.
有人能帮我吗?
#!/bin/bash
files=($(find /usr/src/linux-headers-3.13.0-34/include/ -type f -name '[aeiou][a-z0-9]*.h'))
count=0
headerfiles=($(find /usr/src/linux-headers-3.