the terminal (foot) will not close but xterm will open.
Because that is nonsens. Please do not enter random strings into a shell, you could end up screwing yourself badly.
#!/bin/bash
file=$(fzf)
[ -f "$file" ] && nohup xdg-open "$file" & disown
#!/bin/bash
file=$(fzf)
[ -f "$file" ] || exit
[ -e /dev/fd/0 ] || exec 0</dev/null
[ -e /dev/fd/1 ] || exec 1>/dev/null
[ -e /dev/fd/2 ] || exec 2>/dev/null
xdg-open "$file" & disown
#!/bin/bash
file=$(fzf)
[ -f "$file" ] && xterm & disown
the terminal (foot) will close but xterm will not open.
#!/bin/bash
file=$(fzf)
[ -f "$file" ] && xterm && disown
the terminal (foot) will not close but xterm will open.
I tested with alacritty and firefox. All same.
]]>#!/bin/bash
file=$(fzf)
[ -f "$file" ] && xdg-open "$file" & disown
will not open the file but the terminal will close.
the way I am trying is that I set keybind to the script to open terminal (foot) and run the script.
so I have this
bindsym Alt+r exec foot -e /path/to/script
in my ~/.config/sway/config.
Then I will hit Alt+r and terminal (foot) will open, fzf in it, I type something for search and hit enter.
Here the way I way I want is that, the file open and the terminal (foot) will close.
I still can't get it works.
]]>Edit: the 2nd one btw. the 1st one is nonsensical
]]>#!/bin/bash
file=$(fzf)
[ -f "$file" ] && "xdg-open "$file" & disown"
and
#!/bin/bash
file=$(fzf)
[ -f "$file" ] && xdg-open "$file" & disown
both do not work.
]]>I am trying to have a vary little and simple file launcher.
I have a small script like
#!/bin/bash
file=$(fzf)
[ -f "$file" ] && xdg-open "$file" &
It works very well if I execute the script in terminal.
But I want to use it as Rofi, for example, I will keybind to open terminal and run the script in it.
If I execute by keybinding like
bindsym Alt+r exec foot -e /path/to/script
it will start foot and run fzf in it but it does not launch the file by select and enter.
What I am missing.