home *** CD-ROM | disk | FTP | other *** search
- :
- # @(#) transfile.sh 1.0 94/05/27
- #
- # Copyright (C) ESKER the European Software KERnel
- #
-
- # This shell script example can run on all UNIX system
- # with Bourne Shell interpretor
- # The .SEQ file associated with the emulation must be completed by the
- # following lines :
- # \033put%p0%s p 271
- # \033get%p0%s p 272
-
- PATH=/bin:/usr/bin:/etc
- DOSTOUNIX="DOS->UNIX"
- UNIXTODOS="UNIX->DOS"
- ASCII="Ascii"
- BINARY="Binary"
- NONE="None"
- QUOTE="'"
-
- PromptDirection()
-
- {
- while true
- do
- echo "\n\tFILE TRANSFER DIRECTION\n"
- echo "\t1. $DOSTOUNIX"
- echo "\t2. $UNIXTODOS \n\n\n\n"
- echo "\tSelect an option or enter q to quit : \c"
- read answer
- case $answer in
- 1) direction=$DOSTOUNIX
- return 0;;
- 2) direction=$UNIXTODOS
- return 0;;
- [Qq]) return 0;;
- *) ;;
- esac
- done
- }
-
- PromptMode()
-
- {
- while true
- do
- echo "\n\tFILE TRANSFER Mode\n"
- echo "\t1. $ASCII"
- echo "\t2. $BINARY \n\n\n\n"
- echo "\tSelect an option or enter q to quit : \c"
- read answer
- case $answer in
- 1) mode=$ASCII
- return 0;;
- 2) mode=$BINARY
- return 0;;
- [Qq]) return 0;;
- *) ;;
- esac
- done
- }
-
- TransferFile()
- { if [ "$source" = $NONE ]
- then
- echo "Invalid Source File Name!"
- return 0
- fi
- if [ "$direction" = $DOSTOUNIX ]
- then ESCAPE="\033\033put"
- else ESCAPE="\033\033get"
- fi
- if [ "$mode" = $BINARY ]
- then MODE="-b"
- else MODE=""
- fi
- if [ "$target" = $NONE ]
- then TARGET=""
- else TARGET=$target
- fi
- if [ $direction = $DOSTOUNIX ]
- then SOURCE=`echo $source | dd conv=ucase 2>/dev/null | sed "s#/#\\\\\\\\\\\\\\\\\\\\\\#g"`
- TARGET=$TARGET
- else SOURCE=$source
- TARGET=`echo $TARGET | dd conv=ucase 2>/dev/null | sed "s#/#\\\\\\\\\\\\\\\\\\\\\\#g"`
- fi
-
- echo "Starting File Transfer..."
- echo "$ESCAPE$QUOTE$MODE $SOURCE $TARGET$QUOTE"
- read answer
- $answer
- echo "Transfer Done..."
- echo "Press Return to Continue"
- read answer
- }
-
- direction=$DOSTOUNIX
- source=$NONE
- target=$NONE
- mode="Ascii"
- while true
- do
- DOSUNIX=0
- echo "\n\tFILE TRANSFER\n"
- echo "\t1. Direction [$direction]"
- echo "\t2. Mode [$mode]"
- echo "\t3. Source File Name [$source]"
- echo "\t4. target [$target]\n"
- echo "\t5. Start the File Transfer\n\n\n"
- echo "\tSelect an Option or Enter q to Quit : \c"
- read answer
- case $answer in
- 1) PromptDirection;;
- 2) PromptMode;;
- 3) echo "Warning: You must use the car '/' instead of the car '\\' for the DOS File Name"
- echo "Enter the File Name You Want to Transfer :\c"
- read source;;
- 4) echo "Warning: You must use the car '/' instead of the car '\\' for the DOS File Name"
- echo "Enter the Destination File or Directory :\c"
- read target;;
- 5) TransferFile;;
- [Qq]) exit 0;;
- *) ;;
- esac
- done
- echo "Warning: You must use the car '/' instead of the car '\\' for the DOS File Name"
-