currently what I'm trying to do in Bash on my Ubuntu machine is utilize xdg-open to find a certain path or file.
In the command line, here's what typically happens;
When I run xdg-open ~/Downloads/,
This opens the file manager in the ~/Downloads/ folder, regardless of where my current directory is, as it should.
However, when I run xdg-open ~/Downloads/ in a bash script, it attempts to read from the script's path and the path provided, which results in something similar to xdg-open /path/of/my/script/~/Downloads/, which I don't want.
My current script looks a bit like this;
#!/usr/bin/env bash
input=$(zenity --entry --text="Enter the URL or file." --title=Run --window-icon=question)
echo version=$BASH_VERSION
xdg-open "$input"
exit
How could I make it so my Bash script's xdg-open line behave how it does in the command line?
You can use
$HOMEinstead of~.