从txt文件运行bash命令 [英] Run bash commands from txt file

查看:67
本文介绍了从txt文件运行bash命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在txt文件中有一些命令,我​​需要逐行执行所有命令.我该怎么办?

I have some commands in txt file and I need to execute all them line by line. How could I do it?

推荐答案

只需bash file:

$ cat file 
date
echo '12*12' | bc

$ bash file
Mon Nov 26 15:34:00 GMT 2012
144

在使用别名的情况下,只需运行bash -i file

In case of aliases just run bash -i file

无需担心文件扩展名或执行权限.

这篇关于从txt文件运行bash命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆