3 ms·
'And guess what's the value of "HOME" in bash?' In the rm line of the snippet above, "/some/location". Magic variables in bash tend to lose their magic once s
by dllthomas 13y ago
'And guess what's the value of "HOME" in bash?'
In the rm line of the snippet above, "/some/location". Magic variables in bash tend to lose their magic once set.
- Robin_Message 13y agoI assume `set HOME = /some/location` is the tcsh syntax to set a variable. In Bash, it doesn't do anything useful.
- hapless 13y agonope. try it: set HOME; echo $HOME. on IRIX, $HOME for root is almost certainly root. So the resulting command is rm -rf /
- dllthomas 13y agoI missed that set HOME doesn't set HOME (I was pre-coffee). What I said about un-magic-ing is true for sure. "HOME=foo; echo $HOME" will print "foo". Interestingly, it's propagated. "HOME=foo sh -c 'echo $HOME'" will also print "foo".