简体   繁体   English

linux shell脚本在当前文件夹中运行可执行文件

[英]linux shell script to run an executable file in current folder

I have an executable file always in /home/a called toUpperCase . 我总是在/ home / a中有一个名为toUpperCase的可执行文件。

Now I am in the folder /home/bla/blabla/b where I have a text file to be converted to uppercase ( toConvert.txt ). 现在,我在文件夹/ home / bla / blabla / b中 ,我有一个要转换为大写的文本文件( toConvert.txt )。 All I want to do is a script that executed in /home/bla/blabla/b does something like 我要做的就是在/ home / bla / blabla / b中执行的脚本执行类似

#!/bin/bash
./"/home/a/toUpperCase" toConvert.txt

So in the end I shoud have converted.txt in the folder /home/bla/blabla/b 所以最后我应该在/ home / bla / blabla / b文件夹中转换convert.txt

But it gives me an error like line 2: .//home/a/toUpperCase: does not exist 但这给了我类似line 2: .//home/a/toUpperCase: does not exist的错误line 2: .//home/a/toUpperCase: does not exist

How con I resolve this problem? 我如何解决这个问题? thank you! 谢谢!

Change your script to: 将脚本更改为:

#!/bin/bash
"/home/a/toUpperCase" toConvert.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM