Reputation: 13
I need to convert a batch file to a shell file to run it on Ubuntu. I'm new with bash scripting so would you please help me with a piece of the script?
My batch code is :
::Version detector
set Sverion=%~dp0\*.jar
FOR /f %%i IN ("%Sverion%") DO (
set SOver=%%~ni
)
Would you please explain what set Sverion=%~dp0\*.jar
means and how I can convert it to shell?
Thank you, Diana
Upvotes: 1
Views: 2122
Reputation: 81002
Explanation of ~dp0
can be found at http://en.wikibooks.org/wiki/Windows_Batch_Scripting#String_processing.
The bash equivalent can be found at How do I determine the location of my script? I want to read some config files from the same place. and also the first "Related" post listed in the sidebar of this post.
Upvotes: 1