0

I want to make a bash function to change my directory to a folder only passing a specific code

change() {
   cd "~/Documents/user/projects_folder/$1"
}

However this is giving me an error, what am I doing wrong?

Charles Duffy
  • 235,655
  • 34
  • 305
  • 356
  • You can't put the `~` inside quotes. – Charles Duffy Jun 29 '18 at 20:52
  • `change() { cd ~/"Documents/user/projects_folder/$1"; }` will work fine -- the only change being moving the quotes to start only after the tilde. Or of course you can use `$HOME` inside quotes without any problem. – Charles Duffy Jun 29 '18 at 20:52

0 Answers0