1

So I'm learning today that Bash is all sorts of weird.

I'm trying to set up a variable that goes to a folder on my Mac (Bash 3.2)

FOLDER=".../Application Support/..."

But...

Bash will choke and say something like:

.../Application: No such file or directory

It will still choke if I use {}

{.../Application: No such file or directory

How can I get access to this folder via Bash?!

ovatsug25
  • 7,786
  • 7
  • 34
  • 48
  • Referenced: https://stackoverflow.com/questions/14587972/how-to-iterate-over-list-which-contains-whitespaces-in-bash – ovatsug25 Feb 22 '20 at 17:28
  • How are you trying to reference `FOLDER` in your script when you use it to open a file or a directory? – denis_lor Feb 22 '20 at 17:31
  • @denis_lor — it's actually not a script. It's in my `.bash_profile` and I'm trying to make a shortcut to get to it. – ovatsug25 Feb 22 '20 at 17:32
  • You put this as an example in your `.bash_profile`: `alias godesktop='cd ~/Desktop/'` and then do a `source .bash_profile` to refresh the state. And then in terminal type `godesktop` – denis_lor Feb 22 '20 at 17:37
  • 1
    an example with whitespace would be `alias godesktop='cd ~/Desktop/Application\ Support'` – denis_lor Feb 22 '20 at 17:39
  • 1
    I got it :) Thank you. Made it with variable too — `alias go...='cd "$VAR_NAME"'` – ovatsug25 Feb 22 '20 at 17:44
  • And in case you need to type `cd` yourself, then put in bash_profile only `FOLDER='Desktop/Application Support'` and call it in terminal like this: `cd "${FOLDER}"` – denis_lor Feb 22 '20 at 17:44
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/208328/discussion-between-denis-lor-and-ovatsug25). – denis_lor Feb 22 '20 at 17:45

0 Answers0