I have a file containing a list of commands which I run from my .bash_profile
as
source my_cmds
For eg:
$cat my_cmds
scripts=~/scripts
assuming my $HOME
is /Users/knayak
, when I run
cd $scripts
in the prompt, it takes me to /Users/knayak/scripts
Now, I have a path in this form(which cannot be renamed for some reasons), for which I don't know how to set a command variable so that I can cd $path
using that variable.
/Users/knayak/Somedir - some name Inc/Tasks
I tried adding all these in my my_cmds
file to set an environment variable tasks
,
$cat my_cmds
tasks=~/Somedir - some name Inc/Tasks
tasks="~/Somedir - some name Inc/Tasks"
tasks=~/"Somedir - some name Inc/Tasks"
...
and many more, including single quotes in some, but none of them seem to work when I do cd $tasks
. Most of them fail with the error.
cd: "/Users/knayak/Somedir: No such file or directory
I need to set the proper value in the form tasks=~/<whatever>
for cd $tasks
to work with this path?
cd "$tasks"
. – Michael Homer May 25 '18 at 08:10tasks=~/"Somedir - some name Inc/Tasks"
andcd "$tasks"
– muru May 25 '18 at 08:19