红联Linux门户
Linux帮助

怎样写一个shell脚步的安装程序命令?

发布时间:2010-01-10 11:25:43来源:红联作者:ypb455360299
现在有a,b,c三个文件夹,手动安装方法是进入各个文件夹,打开终端,第一步 输入./configure +回车 第二步 make+回车 第三步 make install+回车。现在要怎样写个install.sh的shell脚步,让它能在终端里直接输入./install.sh就能自动安装。希望高手能不吝赐教!非常感谢!!
文章评论

共有 22 条评论

  1. zhoutingting 于 2011-12-14 21:49:23发表:

    for d in a b c; do cd /root/$d; ./configure && make && make install; done
    或者
    cd /root
    for d in a b c; do cd $d; ./configure && make && make install; cd -; done

  2. zhoutingting 于 2011-12-14 21:49:03发表:

    cd /path/to/a
    ./configure && make && make install
    cd /path/to/b
    ./configure && make && make install
    cd /path/to/c
    ./configure && make && make install

  3. vikenfeng 于 2011-12-14 16:27:52发表:

    很好

  4. hxm_henry 于 2011-12-05 21:42:51发表:

    学习了!

  5. zhbitpaipai 于 2011-12-05 16:27:38发表:

    学习

  6. daxibu 于 2011-12-02 18:59:24发表:

    学习一下

  7. wuxingang5 于 2011-11-26 20:00:57发表:

    简单实用就好

  8. shell_master 于 2011-11-26 17:08:40发表:

    shell很强大的,把你想要做的一步一步加进去就可以了,难的地方无非是那些参数,变量设置...

  9. 淡水无痕 于 2011-10-26 20:22:28发表:

    3# acrofox

    for d in a b c;
    这句是什么意思?

  10. jason_liu 于 2011-10-26 19:05:10发表:

    学习了

  11. jason_liu 于 2011-10-26 19:01:27发表:

    想学习编译安装

  12. wang4289273 于 2011-08-21 00:41:38发表:

    3# acrofox


    哈哈。我看懂了。
    太感谢了。不过就是不知道“and”和“or”的符号在linux怎么打出来啊?

  13. bawoshiji 于 2011-08-20 23:59:51发表:

    for 和which 循环 好好学学 能解决大部分批量作业问题~~

  14. wenhao1129 于 2011-07-24 21:05:08发表:

    我也想学习

  15. Global 于 2011-07-23 13:57:55发表:

    哦,我知道了,原来你是想写编译安装啊.这个写起来还是有点难度的!

  16. every_why 于 2011-07-22 18:55:32发表:

    学习了

  17. jasonlv 于 2011-07-20 21:47:18发表:

    4# child7


    ding

  18. hdandan 于 2010-04-24 14:16:39发表:

    其实,最简单就是把你把有要执行的命令
    全部写到一个文件里。然后执行文本就可以了。

  19. sl41984 于 2010-01-15 11:08:41发表:

    cd /path/to/a
    ./configure && make && make install
    cd /path/to/b
    ./configure && make && make install
    cd /path/to/c 
    ./configure && make && make install
    这个挺好

  20. child7 于 2010-01-11 12:25:19发表:

    嗯,搭车学习了

  21. acrofox 于 2010-01-10 15:36:01发表:

    [code]cd /path/to/a
    ./configure && make && make install
    cd /path/to/b
    ./configure && make && make install
    cd /path/to/c
    ./configure && make && make install[/code]或者,假设 a、b、c 三个目录都在同一个目录下(比如 /root 下),那么:[code]for d in a b c; do cd /root/$d; ./configure && make && make install; done
    或者
    cd /root
    for d in a b c; do cd $d; ./configure && make && make install; cd -; done[/code]

  22. checked 于 2010-01-10 14:12:03发表:

    帮顶