baslinux AT lists.ibiblio.org
Subject: Baslinux mailing list
List archive
- From: Lee Forrest <lforrestster AT gmail.com>
- To: baslinux AT lists.ibiblio.org
- Subject: Re: [BL] Automating copying to floppy disk
- Date: Wed, 17 Jan 2007 18:18:22 +0000
On Mon, Jan 15, 2007 at 12:39:34AM +0000, sindi keesan wrote:
>
[delete]
> How could I automate things so that a file saved to Abiword's default
> location would be copied to a floppy disk, maybe with some script I can
> invoke from the icewm menu to
This is as foolproof a script for a newbie I could come up with. Needs full
screen.
The leftmost column of "#" is to make original formatting clear: One at the
beginning of each line.
##!/bin/sh
#
##Lee Forrest
#
## for Sindi K.
#
## to bring up in an xterm (not a part of this script)
##set `stty size`; rxvt -g ${2}X${1} +sb -e copyfloppy.sh
#
##copyfloppy.sh
##copy one or more files to floppy
#
##if you are going to use this for copying files from a
##single directory, fill in 'default_dir' and uncomment it
#
##### user configurable variables
#dev=/dev/fd0
#mp=/fd #mount point
##default_dir=
##### end user configurable variables
#
##function to call for exiting when something goes wrong
#
#exitf () {
#clear
#echo
#echo
#echo "exiting on error"
#echo
#echo
#echo "umounting `echo $dev` if mounted"
#echo
#echo
## '> /dev/null 2>&1' - sends stdout and stderr to /dev/null
## so nothing is sent to screen
#umount /dev/fd0 > /dev/null 2>&1 &&
#echo "Remove the floppy now."
#sleep 5
#echo
#echo
#echo "Exiting"
#echo
#echo
#clear
#exit
#}
#
#
#clear # clear the screen
#
## just "echo" prints blank line
#
##make sure that the mount point and device are free and send
##output to /dev/null - if not, exit with error message
#
## "\|" means "or" in grep argument.
#
#if df | grep "${mp}\|${dev}" > /dev/null
#then echo; echo; echo "${mp} or ${dev} already in use."
#sleep 5
#exitf
#fi
#
#
##if default_dir is set, and the directory exists, cd there - if not, ask
##user to enter directory they want to copy files from, or to just hit Enter
##if they are there already
#echo
#echo
#if [ $default_dir ] > /dev/null 2>&1 ; then cd $default_dir > /dev/null 2>&1
; fi
#if [ $? != 0 ] > /dev/null 2>&1 ; then echo "default directory doesn not
exist - continuing"
#echo "Put floppy in drive and THEN enter the full path to the directory"
#echo "where the files you want to copy are. Just hit Enter/Return if you are"
#echo "already there."
#else echo "Put floppy in drive and THEN hit Enter/Return."
#fi
#
#echo
#echo
##take input from prompt and feed it to variable $_dir
#
#read _dir
#
##if $_dir isn't an empty string, and the directory exists, cd there
##otherwise exit with error message
#echo; echo
#if [ $_dir ] > /dev/null 2>&1 ; then cd $_dir > /dev/null 2>&1 ; fi
#if [ $? != 0 ] ; then echo "That directory does not exist - exiting"
#exitf
#fi
#
## try to mount the floppy device on mount point and send it's standard error
output
##to /dev/null, and if it doesn't work, exit with error message
#
#mount "$dev" "$mp" 2> /dev/null
#if [ $? -eq 1 ] ; then echo "Mount failed: Bad Floppy or it has wrong
filesystem on it"
#echo "or the mount point or device file do not exist"
#exitf
#fi
#clear
#echo
#echo
#echo "listing files in current directory and floppy - if they take up more
than"
#echo "a screenful, use Shift-PageUp/PageDown - Space to get back to the
prompt"
#echo "if needed"
#echo
#echo "files in current directory:"
#
##run ls on present working directory - evade any aliases by using full path
#echo
#/bin/ls -F `pwd`
#echo
#echo
#echo "files on floppy - if you copy files to the floppy with the same name"
#echo "they WILL be overwritten"
#echo
#/bin/ls -F `echo "$mp"`
#echo
#echo
#echo "Enter names of files you want to copy, seperated by one or more
spaces."
#echo "If a file is in another directory, use full path."
#echo
#echo
#read "_files"
#
##assign the words in $_files to the positional parameters $1 $2 ...
#
#set `echo "$_files"`
#
#clear
#
## make sure files exist
#
#echo
#echo
#echo "checking to make sure files exist"
#fc=`/bin/ls "$@" > /dev/null 2>&1`
#echo
#echo
#if [ "$fc" = "" ] > /dev/null 2>&1 ; then echo "No existing files were
specified at the prompt"
#sleep 3
#exitf
#else set `echo "$fc"`
#fi
#sleep 3
#clear
#echo
#echo
#
##run ls and if it exits with an error (non-zero)...
#
#/bin/ls "$@" > /dev/null 2>&1
#if [ "$?" != "0" ] > /dev/null 2>&1 ;then
#echo "note that one or more files entered do not exist - continuing"
#fi
##copy files to floppy
#
#cp "$@" "$fd" > /dev/null 2>&1 &&
#
##write the files to disk - redundant, because umount will do it of its
##own, but I think it is cleaner
#
#sync &&
#echo
#echo
#echo "copy was successful"
#echo
#echo
#umount /dev/fd0
#echo "remove the floppy now"
#sleep 5
#echo
#echo
#clear
#exit 0
[delete]
Hope it works for you,
Lee
BasicLinux: Small is Beautiful
http://www.basiclinux.com.ru
-
Re: [BL] Automating copying to floppy disk
, (continued)
-
Re: [BL] Automating copying to floppy disk,
sindi keesan, 01/15/2007
-
Re: [BL] Automating copying to floppy disk,
Karolis Lyvens, 01/15/2007
-
Re: [BL] Automating copying to floppy disk,
sindi keesan, 01/15/2007
-
Re: [BL] Automating copying to floppy disk,
Karolis Lyvens, 01/15/2007
-
Re: [BL] Automating copying to floppy disk,
sindi keesan, 01/15/2007
- Re: [BL] Automating copying to floppy disk, sindi keesan, 01/15/2007
- Re: [BL] Automating copying to floppy disk, Karolis Lyvens, 01/16/2007
-
Re: [BL] Automating copying to floppy disk,
sindi keesan, 01/15/2007
-
Re: [BL] Automating copying to floppy disk,
Karolis Lyvens, 01/15/2007
-
Re: [BL] Automating copying to floppy disk,
sindi keesan, 01/15/2007
-
Re: [BL] Automating copying to floppy disk,
3aoo-cvfd, 01/15/2007
- Re: [BL] Automating copying to floppy disk, sindi keesan, 01/15/2007
-
Re: [BL] Automating copying to floppy disk,
Karolis Lyvens, 01/15/2007
- Re: [BL] Automating copying to floppy disk 8, Lee Forrest, 01/15/2007
-
Re: [BL] Automating copying to floppy disk,
Lee Forrest, 01/17/2007
-
Re: [BL] Automating copying to floppy disk,
sindi keesan, 01/18/2007
-
Re: [BL] Automating copying to floppy disk 9,
Lee Forrest, 01/18/2007
-
Re: [BL] Automating copying to floppy disk 9,
3aoo-cvfd, 01/18/2007
-
Re: [BL] Automating copying to floppy disk B,
Lee Forrest, 01/18/2007
- Re: [BL] Automating copying to floppy disk B, 3aoo-cvfd, 01/18/2007
-
Re: [BL] Automating copying to floppy disk B,
Lee Forrest, 01/18/2007
-
Re: [BL] Automating copying to floppy disk 9,
sindi keesan, 01/18/2007
- Re: [BL] Automating copying to floppy disk E, Lee Forrest, 01/19/2007
-
Re: [BL] Automating copying to floppy disk 9,
Ron Clarke, 01/19/2007
- Re: [BL] Automating copying to floppy disk 9, sindi keesan, 01/19/2007
-
Re: [BL] Automating copying to floppy disk 9,
3aoo-cvfd, 01/18/2007
-
Re: [BL] Automating copying to floppy disk 9,
Lee Forrest, 01/18/2007
-
Re: [BL] Automating copying to floppy disk,
sindi keesan, 01/18/2007
-
Re: [BL] Automating copying to floppy disk,
sindi keesan, 01/15/2007
Archive powered by MHonArc 2.6.24.