I have made a script to open Spotify with wine:
#!/bin/bash
DIR="/home/jorgsk/.wine/drive_c/Program Files/Spotify/"
cd "$DIR"
wine spotify.exe 2>/dev/null
I'm passing "$DIR" to cd with quotes because of the whitespace in "Program Files"; if I don't have the quotes "/home/jorgsk/.wine/drive_c/Programs" will be considered as the argument to cd, which obviously will result in an error message.
Spotify starts fine if I launch the above script from its local directory (/home/jorgsk/bin) with ./spotify. However, since I wish to launch it from wherever, I have /home/jorgsk/bin added to the $PATH variable in .bashrc. When I write "spotify" from for example my home directory, I get the error message
bash: /home/jorgsk/.wine/drive_c/Program: No such file or directory
which is the same error message I get if I don't include $DIR in quotes when launching tje script with ./spotify from the script's directory.
What is happening here?