什么之间的区别<<,<<<并< <在bash?
bash -以下 bash shell 代码是什么意思?好像是用来把输出最后一个代码作为输入。如果是这样,我可以把它写成bashorxargs bash吗?
curl --silent --location https://rpm.nodesource.com/setup | bash -
Run Code Online (Sandbox Code Playgroud) 我正在使用 ubuntu 服务器 12.04,现在我想使用 rsync 备份一些文件,这里是一个尝试:
rsync -aAX $HOME/Documents/* $HOME/Backups/TEST --exclude={$HOME/Documents/another/*,$HOME/Documents/temp/*}
Run Code Online (Sandbox Code Playgroud)
如您所见,我想将文件夹$HOME/Documents中的所有文件备份到文件夹$HOME/Backups/TEST,但排除文件夹another和temp中的文件。但是我失败了,rsync 仍然复制了两个排除文件夹中的文件:
ls $HOME/Backups/TEST/another
test
Run Code Online (Sandbox Code Playgroud)
test是文件夹another中的一个文件,虽然我在 rsync 中排除了该文件,但它也被复制了,为什么?如何让这些文件被实际排除?
我正在编写一个脚本来获取文件夹(包括子文件夹)中的所有文件:
#!/bin/bash
function loop() {
files=`ls -1Fd $1`
echo "$files" |
while IFS= read -r file; do
if [[ "$file" == */ ]]; then
loop "$file*"
else
echo "$file"
fi
done
}
loop "$PWD/*"
Run Code Online (Sandbox Code Playgroud)
我尝试以这种方式测试脚本:
#create folders and files
mkdir test\ folder && mkdir test\ folder/test\ subfolder && touch test\ folder/test\ subfolder/test\ file && cd test\ folder
#execute the script
~/path_to_the_script/test.sh
Run Code Online (Sandbox Code Playgroud)
但它不起作用,这是错误:
ls: cannot access /home/user/Documents/test: No such file or directory
ls: cannot access folder/*: No such file or directory …Run Code Online (Sandbox Code Playgroud) 我想dnsmasq在 ubuntu 15.10 上设置上游服务器。我已经阅读了很多关于 dnsmasq 的文档或资源,其中提到了一个名为 的配置文件/etc/dnsmasq.conf,但我找不到它。我试图找出如何dnsmasq在系统启动已经开始,但是我找不到dnsmasq下/etc/init.d,无论是。
那么我应该修改哪个文件来设置上游服务器dnsmasq?
这是用于跟踪文件中的更改并将内容输出到终端的 shell 代码:
while read LINE
do
echo $LINE
done < `tail -f /var/log/messages`
Run Code Online (Sandbox Code Playgroud)
它不起作用,为什么?