I have file with following info
FileName:VersionInfo.properties
Installed Version:13.7.0-2
Previous Version:13.6.0-12
FileName: rollback.sh
#!/bin/bash
uninstall_rpm ClientInfrastructure $version
How can I get the value into variable $version from Previous Version of VersionInfo.properties file. $version should have the value 13.6.0-12
sed
solution:To use it in a script you can do:
If that is all you have in your script then you can basically do it on the command line.
Grep + parameter expansion solution:
If the file's written like that you just need the variable
$version
exported properly.if you really want to change the contents of
rollback.sh
, use ed: