I am new to shell scripting and stepped through this quick guide:
which was helpful but left a lot of questions about working with variables unanswered. My current frustration is trying to use a variable that stores a path in commands.
For example, the following script:
#!/bin/bash iTunesU_Source="~/Music/iTunes/iTunes\ Media/iTunes\ U/" ls -al $iTunesU_Source iTunesU_Source_symlink="~/Music/iTunes_U/" ls -al $iTunesU_Source_symlink ls -al ~/Music/iTunes/iTunes\ Media/iTunes\ U/
ls: Media/iTunes\: No such file or directory ls: U/: No such file or directory ls: ~/Music/iTunes/iTunes\: No such file or directory ls: ~/Music/iTunes_U/: No such file or directory total 0 drwxr-xr-x 7 me staff 238 Mar 8 10:06 . drwxr-xr-x 11 me staff 374 Mar 8 11:13 .. drwxr-xr-x 27 me staff 918 Mar 8 08:44 Game Theory - Audio drwxr-xr-x 3 me staff 102 Mar 8 10:03 Introduction to Algorithms drwxr-xr-x 23 me staff 782 Mar 8 12:17 Machine Learning drwxr-xr-x 3 me staff 102 Mar 8 10:06 Machine Learning-Stanford
How do I get the command (ls/cd/etc...) to accept the value of the variable like it does for direct input?