I'm not quite sure I understand what you're trying to do. The line you gave is actually two separate commands.
The first one:
Code:
VAR="$VAR{LINUX_VERS}"
Sets the value of VAR to the previous value of VAR with the literal string {LINUX_VERS} tacked onto it.
The second command is, of course:
Code:
head -1 /var/log/dmesg
But it would be fairly pointless, as all it would do is echo the first line of dmesg onto the shell at startup.
";" is simply a concatenator, kind of like a synonym for a new line. the running of the second command occurs after the first one, no matter what the outcome. If you want the second command to run only if the first one is successful, you have to use "&&" instead.
I have no idea what you mean by "regenerating the /var/log/dmesg so the variable LINUX_VERS is set dynamically when machine is booted" either. Could you please explain what you're trying to do in more detail?
As for "screwing up your bashrc", you can always test the command directly in an existing shell first. Any command in bashrc can in theory be run on the command line, and vice-versa. If it screws up in the shell you can just close it and start over.
Finally, please use [code][/code] tags around your code, to preserve formatting and to improve readability.
Edit @savona:
Although it isn't wrong,
$(..) is recommended over `..`, so this is better:
Code:
LINUX_VERS=$( head -1 /var/log/dmesg )
I don't really think this is what the OP wants though. What's the purpose of setting that variable to what could turn out to be a random line from dmesg? My output for the command is currently "
[ 0.000000] Initializing cgroup subsys cpuset", for example.