Re: 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 :)
Reply to: