Created
June 16, 2014 07:23
-
-
Save kunpengku/4616e52ba7e7d1e37d54 to your computer and use it in GitHub Desktop.
将一段代码块的输出 重定向到一个文件中
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SUCCESS=0 | |
E_NOARGS=65 | |
if [ -z "$1" ] | |
then | |
echo "Usage:`basename $0` rpm-file" | |
exit $E_NOARGS | |
fi | |
{ | |
echo | |
echo "Archive Description" | |
rpm -qpi $1 | |
echo | |
echo "Archive Listing" | |
rpm -qpl $1 | |
echo | |
rpm -i --test $1 | |
if [ "$?" -eq "$SUCCESS" ] | |
then | |
echo "$1 can be installed" | |
else | |
echo "$1 cat not be installed" | |
fi | |
} > "$1.test" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment