[问题]请帮我诊断一下这个bash脚本该如何修改

sh/bash/dash/ksh/zsh等Shell脚本
回复
luchen
帖子: 52
注册时间: 2007-07-16 18:40
来自: 浙江

[问题]请帮我诊断一下这个bash脚本该如何修改

#1

帖子 luchen » 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",以及自动输入账号密码?
悬非
帖子: 19
注册时间: 2007-07-27 22:16
联系:

#2

帖子 悬非 » 2007-11-04 19:30

代码: 全选

apt-get install expect
man expect
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

#3

帖子 bones7456 » 2007-11-05 11:14

sudo pppoeconf 只要执行一次就好了,以后执行 pon dsl-provider 即可.
关注我的blog: ε==3
kinwin
帖子: 225
注册时间: 2007-08-28 13:19
来自: USTC

#4

帖子 kinwin » 2007-11-05 22:22

有个叫yes的小程序
回复