Skip to content
Advertisement

Pass filename from Nautilus to shell script

I am trying to execute a shell script that gets for an argument a file name.

I can do it if I go to the terminal and type the full PATH.

But I am trying to make this more user friendly so I what I want to do is to send the argument (complete path) from the file manager or nautilus.

Is it possible?

Advertisement

Answer

Ok I am going to share a way I found that works.

All I was trying to do was to pass a path as an argument, without typing it on the command line. to make it user friendly.

So I use a zenity tool, file selection, to browse through the file manager and select the file.

./script.sh $(zenity --file-selection)

See, now I am passing the path of the file I selected.

If you want to try this out, just type in the command line.

zenity --file-selection
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement