RE: Nautilus Scripts

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

 



btw an improved version?



On Mon, 2003-12-15 at 03:16, Ow Mun Heng wrote:
> > -----Original Message-----
> > From: Vikram Goyal [mailto:viki@xxxxxxxxxx]
> > Sent: Friday, December 12, 2003 8:29 PM
> > To: fedora-list@xxxxxxxxxx
> > Subject: Re: Nautilus Scripts
> > 
> > The script seems interesting. Can you post it to the list inline so
> > that whoever finds it fit can have it.
> 
> 
> This is from another site I found on the net
> 
> #!/bin/sh
> # 
> # Add a new text file in the current directory.
> # Script prompts you for the name and if it already exists,
> # then the [ number] is incremented until unique.
> #
> # Distributed under the terms of GNU GPL version 2 or later
> #
> # Copyright (C) 2001 Johnathan Bailes (bailesj@xxxxxxxxxxxxxx)
> # based on work by Jeffrey Philips
> 
> New_Document="`gdialog --title "Name of New Text file?" --inputbox "Name
> the New Text file?" 200 100 2>&1`"
> echo "$New_Document"
> 
> COUNT=1
> 
> if ! [ -a "./$New_Document.txt" ] ; then
>   touch "./$New_Document.txt"
> else
>   while ! [ "$retry" ] ; do
>    let $((COUNT++))
>     if ! [ -a "./$New_Document($COUNT).txt" ] ; then
>         touch "./$New_Document($COUNT).txt"
>         retry=1
>     fi
>   done
> fi
> 
> 
> --
> fedora-list mailing list
> fedora-list@xxxxxxxxxx
> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
-- 
+ No matter how much you do, you never do enough -- unknown
+ Whatever you do will be insignificant,
| but it is very important that you do it -- Gandhi
+ So let's do it...?

Please AVOID sending me WORD, EXCEL or POWERPOINT attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
#!/bin/sh
#
# Add a new text file in the current directory.
# Script prompts you for the name and if it already exists,
# then the [ number] is incremented until unique.
#
# Distributed under the terms of GNU GPL version 2 or later
#
# Copyright (C) 2001 Johnathan Bailes (bailesj@xxxxxxxxxxxxxx)
# based on work by Jeffrey Philips
#
# Mon Dec 15 2003 - Rui Miguel Silva Seabra <rms@xxxxxxxx>
#   zen'ified and avoids to have .txt.txt files.

New_Document="`zenity --title "Create a text file" --entry --entry-text="Name of the new text file" --text="Type a file name..."`"

EXT=".txt"
BNAME=`basename $New_Document $EXT`
if test ! $New_Document == $BNAME ; then
  New_Document=$BNAME
fi
echo "$New_Document"

COUNT=1
if ! [ -a "./$New_Document$EXT" ] ; then
	touch "./$New_Document$EXT"
else
	while ! [ "$retry" ] ; do
		let $((COUNT++))
		if ! [ -a "./$New_Document($COUNT)$EXT" ] ; then
			touch "./$New_Document($COUNT)$EXT"
			retry=1
		fi
	done
fi

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux