[问题]请帮我诊断一下这个bash脚本该如何修改
发表于 : 2007-11-04 18:46
小弟正在学shell中的bash,学到了一大半,然后自己学着编了一个make C语言程序的脚本,下面是我第一次编的脚本,请高手帮忙诊断一下该如何修改才能成功?
#! /bin/bash
# Make a makefile of a C program.
if [ $# -eq 0 -o $# -gt 1 ]; then
echo "Usage: makefile file" 1>&2
exit 1
fi
if [ -d "$file" ]; then
echo "The argument cannot be a directory." 1>&2
echo ""Usage: makefile file" 1>&2
exit 1
else
vim filetext && i
"$file":"$file".c
gcc -o "$file" "$file".c
fi
make "$file"
这个脚本的作用应该是
$cat >filetext
hello:hello.c
TAB gcc -o hello hello.c
然后$make hello以达到编译程序的目的
还有请高手指点一下如何用bash编一个上网登录的程序
一般的话我登录上网必须$sudo pppoeconf
然后点几次“yes“,再输入上网卡的账号密码,在点几次”yes“才能上网
请问如何用bash解决,来自动点“yes",以及自动输入账号密码?
#! /bin/bash
# Make a makefile of a C program.
if [ $# -eq 0 -o $# -gt 1 ]; then
echo "Usage: makefile file" 1>&2
exit 1
fi
if [ -d "$file" ]; then
echo "The argument cannot be a directory." 1>&2
echo ""Usage: makefile file" 1>&2
exit 1
else
vim filetext && i
"$file":"$file".c
gcc -o "$file" "$file".c
fi
make "$file"
这个脚本的作用应该是
$cat >filetext
hello:hello.c
TAB gcc -o hello hello.c
然后$make hello以达到编译程序的目的
还有请高手指点一下如何用bash编一个上网登录的程序
一般的话我登录上网必须$sudo pppoeconf
然后点几次“yes“,再输入上网卡的账号密码,在点几次”yes“才能上网
请问如何用bash解决,来自动点“yes",以及自动输入账号密码?