linuxbashshellfedora-25

using ~/ (user entry) at shell script



I failed to accesses "user entry" by shell script, the following commands interrupt errors ( ls: cannot access '~/Workspace': No such file or directory )

ls ~/Workspace
ls "~/Workspace"
ls "\~/Workspace"

commanding the above via terminal works fine. any ideas?
I'm using fedora 25 without significant customization. thanks.


Solution

  • Are you sure the "Workspace" dir exist on home dir for that user?

    Anyway, try this:

    #!/bin/bash
    ls $HOME/Workspace