New answers tagged


You don't show how you assign the variable in the first place, but usually issues with ~ in variables come from the way you quote (or don't quote) during assignment. To make it work you need to omit quotes when assigning ~ to a variable. $ foo=~ $ echo $foo /Users/pse $ foo="~" $ echo $foo ~ $ ls $foo ls: ~: No such file or directory


I found out what the problem was. I was using a relative path with the ~. I used the absolute path and it worked.


I was facing the same problem, my need was simple which was to set my credentials as environment variables only for the current session of my cli so I did put all my secrets in a shell script and tried to ran it but none of my environment variables ever showed up in my echo statement, below are the steps i followed Create a simple file ...


First check that your path variable is working or not just type (echo $PATH) from terminal it will return the O/P like: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin if saying "commond not found" Then you have to PATH variable to setup path variable below steps 1) vi /etc/paths it's will vi editor to edit type "I" and enter below mention lines /usr/local/...

Top 50 recent answers are included