I am on a Mac and I am trying to use environment variables as a reference holder to run commands.
For example, I have a file with a path like so:
/Applications/Android Studio.app/Contents/Info.plist
I'm trying to read it with the cat command. From this SO question, I can either use a backslash or quotes to use that path, like so:
cat /Applications/Android\ Studio.app/Contents/Info.plist
or
cat "/Applications/Android Studio.app/Contents/Info.plist"
Fantastic!
However, say I export the path as an env var, using export:
export AS_HOME="/Applications/Android Studio.app/Contents"
and then I want to read the Info.plist file using the env var:
//Restart or refresh terminal settings
source ~/.profile
cat $AS_HOME/Info.plist
This is throwing an error where it doesn't understand the path. I've tried setting the env var both ways (one with quotes and the other using backslahses). When I use the echo command with that env var, it prints out fine..
Any thoughts/work arounds on this?