As per my understanding when yum update rpm_name is done $1 will take value 2 or more.
And when yum install rpm_name is done $1 will take a value 1
When doing yum update this works fine and my service is restarted.
Now i did yum remove rpm_name
And then did yum install rpm_name
I got an error saying the service is already stop. Means that the restart line got executed
Somewhow $1 is coming still >1 even though i removed the package.
what could be the reason for this. How can i correct it ?
ohh thanks i will try it out.
also one more thing i want to confirm
as per documentation $1 gives th count of versions of package
so does $1 when doing yum install always return 1 ?
and 0 on doing yum remove, 2 on yum update.
in what cases can the value be greater than 2
arnold
$1 is the first argument, without seeing what the command is, I am not in a position to answer that if you want to check how many arguments are passed to a command
I.e, command argument1 argument2
$0 will have command
$1 will have argument1
$2 will have argument2
To check on the number of arguments I think the notation is $#_@
Usually a successful execution of a command, the status echo $? Or echo $status will be 0. The exit code variable differs based on the shell being used bash I think and sh uses $? Csh I think uses $status.
1 means there was an issue, different issues often have their own exit codes 127 often is related to segmentation fault when trying to run.
Most programs coders, include/publish or use the errno.h defined exit codes to convey the cause of an error.
also one more thing i want to confirm
as per documentation $1 gives th count of versions of package
so does $1 when doing yum install always return 1 ?
and 0 on doing yum remove, 2 on yum update.
in what cases can the value be greater than 2