【发布时间】:2015-06-13 10:02:27
【问题描述】:
我想稍微重建一下我的脚本,让它对其他人更容易。 我认为使用案例和功能会更容易。
IP="192.168.123." #$1 is the last number for the ip-address
regExp="^[0-9]+[-,0-9]*$"
if [ "$#" -eq 0 ]; then
echo "No numbers given "
exit 0
fi
if [ "$1" == "-h" ]; then
echo "Give numbers to test"
exit 0
fi
我想做这样的事情:
if [ "$#" -eq 0 ]; then
echo "No numbers given "
# exit 0 --> do I have to write this?
case
-h ) echo "Give numbers to test";
esac
fi
我必须写那个出口吗? 有什么事情可以让它变得更容易吗?
【问题讨论】:
-
半离题但是,你考虑过python吗?
-
我只用ubuntu 2个月,不懂python :(
-
如果您是 Linux 新手,请继续学习 shell 脚本。你在正确的轨道上。
标签: linux shell ubuntu scripting