FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 05-06-2011, 11:23 PM
Perry Thompson
 
Default 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"



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4DC4830A.2020207@yahoo.fr">http://lists.debian.org/4DC4830A.2020207@yahoo.fr
 
Old 05-07-2011, 10:13 AM
Camaleón
 
Default Nautilus scripts using $1

On Fri, 06 May 2011 19:23:54 -0400, Perry Thompson wrote:

> 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

Shouldn't that be? :-?

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".

(...)

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

(...)

Yep, try with:

filename="${1##*/}"

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2011.05.07.10.13.23@gmail.com">http://lists.debian.org/pan.2011.05.07.10.13.23@gmail.com
 
Old 05-07-2011, 05:14 PM
Perry Thompson
 
Default Nautilus scripts using $1

On 05/07/2011 06:13 AM, Camaleón wrote:
> On Fri, 06 May 2011 19:23:54 -0400, Perry Thompson wrote:
>
>> 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
>
> Shouldn't that be? :-?
>
> 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".
>
> (...)
>
>> How can I fix it so I can use any file in any environment? Maybe somehow
>> set nautilus to use full pathnames? Any ideas?
>
> (...)
>
> Yep, try with:
>
> filename="${1##*/}"
>
> Greetings,
>
Thank you! It works perfectly


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4DC57DFF.6060400@yahoo.fr">http://lists.debian.org/4DC57DFF.6060400@yahoo.fr
 

Thread Tools




All times are GMT. The time now is 12:15 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org