开发者

Shell Scripts with conditional echos

How do I exclude what my script is doing and only hav开发者_Python百科e echo's print?

For instance, i am taring a directory and I don't want every file it tar's to echo.. only the echo command.

#! /bin/bash 

clear

echo "Compressing the files"

cd ~/LegendaryXeo/html/
tar --exclude=".git" -cvf site.tar *
mv site.tar ~/LegendaryXeo/work/
cd ~/LegendaryXeo/work/

clear

echo "Extracting the site"

tar -xvf site.tar 

echo "Deleting Tar"

cd ~/LegendaryXeo/work/

rm -f site.tar

clear

echo "Copying files to server"

scp -r ~/LegendaryXeo/work/* user@site.com:~/../../domains/


Redirect the output of tar to /dev/null:

tar [your options] [files] &> /dev/null

Any echo command you have in your script will still output to the screen.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜