dylanaraps / fff

📁 A simple file manager written in bash.
MIT License
4.07k stars 171 forks source link

[Improvement] Support Multiple Words in $FFF_TRASH_CMD #160

Open cmplstofB opened 3 years ago

cmplstofB commented 3 years ago

Hello. I want to specify "gio trash" into the trash command variable ($FFF_TRASH_CMD), but shell regards it as a single command.

export FFF_TRASH_CMD='gio trash'

$ fff
fff: Running trash
/path/to/fff: line 522: gio trash: command not found

Would you please support multiple words in $FFF_TRASH_CMD so that users can specify commands in more flexible way?

yellowhat commented 3 years ago

I have the same problem, I would like to remove files/folders without moving to the trash, like:

export FFF_TRASH_CMD="rm -rf"

I think that the problem is releated to this line:

command "$FFF_TRASH_CMD" "${@:1:$#-1}"

The double quotes for $FFF_TRASH_CMD force command to consider it as an entire command, removing should work:

command $FFF_TRASH_CMD "${@:1:$#-1}"

Not sure if there is a better way.

Thanks

lcorag commented 1 year ago

@cmplstofB A very simple workaround is to crate an executable script invoking the command you need. For example, to use gio trash (I had the same problem),

nano fff_giotrash

the file is simply

#!/bin/sh
gio trash $1

make the script executable chmod +x fff_giotrash and available in your $PATH. Then

export FFF_TRASH_CMD="fff_giotrash"