[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Nautilus scripts using $1



Hi there. I made a nautilus script so that I can right-click on a file,
use it in a program, and then move the produced file back to the working
directory.

I made a test script to try it out.

#!/bin/bash

echo "$1" $HOME/Desktop/test.txt

When I am in any Nautilus folder and I right-click on a file and run the
script, in the contents of test.txt I have "filename".

However, when I use the script straight from the desktop it does not
work the same way. When I right-click on the file and choose to run the
Nautilus script, it gives me the full path to the file in test.txt.

I'm not sure if that's clear enough, I'll give an example in case it's not.

Filename is on my desktop.

Running the script in Nautilus, test.txt shows "Filename"
Running the script straight from the desktop, test.txt shows
"/home/rypervenche/Desktop/Filename"

How can I fix it so I can use any file in any environment? Maybe somehow
set nautilus to use full pathnames? Any ideas?

(Here is my actual script)
#!/bin/bash

# Fix full pathname of input file
location=$(pwd)
location="$location""/"
filename="$1"

# Change working directory to Monolith
cd /home/rypervenche/Monolith

# Make Mono file
./monolith base/Monolith_7D4.wav -m "$location$filename"

# Move Mono file to folder of original file
mv mono/* "$location"



Reply to: