HI, I have made a script abc.sh, now i want it to display its version when i run it. suppose im running script, ./abc.sh -v, i want it to d
HI,
I have made a script abc.sh, now i want it to display its version when i run it. suppose im running script, ./abc.sh -v, i want it to display its version number. |
Quote:
I don't mean to be rude, but we don't do people's homework for them. We are happy to help you where you get stuck, but we expect that you have made at least some effort of you're own. Can you post your efforts and use CODE tags when posting scripts - so it's easy to read it. I've asked for this to moved to the Programming forum. |
Look at
Code:
getopts |
A shell script is only plain readable English text. If the script does not store or refer to a version number store somewhere else, there is clearly no way it can display the version number. Also the version number is not stored in the file header.
OK |
Yes, either getopts() or positional parameters will do the job of collecting run time options which you can use. I'm throwing in some links there since they are hard to find in all the noise in the search engines these days.
|
Quote:
Please post a copy of your script as well as what you intend to say when the version request argument is used. Please also take a look at the advice offered by other members about parsing script options. Do you understand how to output information when you have parsed an option and then need to inform the user about the script version? In the future, it will be helpful to provide more details of your question. |
agree, define "it" so one can show you how to assign/obtain the version to it so it can show its version to the user. get it?
it is implying the scripts version, did you by any chance use an echo command in your script, and use a variable assignment? maybe put the two ideas together and see what you come up with. |
All times are GMT -5. The time now is 10:53 PM. |