![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| character set conversion in unix C | gucho | High Level Programming | 1 | 03-01-2008 08:27 AM |
| Dos to Unix conversion | john413 | Shell Programming and Scripting | 1 | 09-10-2005 03:13 PM |
| Unix to EBCDIC conversion | Bab00shka | UNIX for Dummies Questions & Answers | 2 | 01-20-2005 12:58 PM |
| unix to windows conversion | misc19432043 | Filesystems, Disks and Memory | 2 | 10-11-2002 02:08 AM |
| Time conversion in Unix | kamlakar | UNIX for Advanced & Expert Users | 1 | 04-22-2002 12:55 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
conversion from Unix to windows
Hey guys,
Im looking to convert the following script into batch language for windows / DOS but my knowledge of batch syntax is nill - but i have good knowledge of UNIX shell...can anyone help? #!/bin/sh if [ $# -lt 2 ] ; then echo "UNCERTAIN:" echo "Too few arguments" echo "Usage: file_exists <filename> <exists|notexists|contains> [<text_to_search>]" echo "!!SCRIPT_FINISHED!!" exit 1 fi if [ $2 == "exists" ] ; then if [ -f "$1" ] ; then echo "TRUE:" echo "$1 file exists" else echo "FALSE:" echo "$1 file does not exist" fi fi if [ $2 == "notexists" ] ; then if [ -f "$1" ] ; then echo "FALSE:" echo "$1 file exists" else echo "TRUE:" #!/bin/sh if [ $# -lt 2 ] ; then echo "UNCERTAIN:" echo "Too few arguments" echo "!!SCRIPT_FINISHED!!" exit 1 fi if [ $2 == "exists" ] ; then if [ -f "$1" ] ; then echo "TRUE:" echo "$1 file exists" else echo "FALSE:" echo "$1 file does not exist" fi fi if [ $2 == "notexists" ] ; then if [ -f "$1" ] ; then echo "FALSE:" echo "$1 file exists" else echo "TRUE:" echo "$1 file does not exist" fi fi if [ $2 == "contains" ] ; then if [ -f "$1" ] ; then TIME=`date|tail -c19|head -c5` FOUND=`cat $1|grep $TIME|grep $3` if [[ -n $FOUND ]] ; then echo "TRUE:" echo "File $1 contains [$3]" else echo "FALSE:" echo "File $1 does not contain [$3]" fi else echo "FALSE:" echo "$1 file does not exist" fi fi echo "!!SCRIPT_FINISHED!!" Thanks josh |
|
||||
|
I would chime in with the same response regarding CYGWIN. You can write some very functional DOS/NT scripts but even simple tasks are much tougher to implement. CYGWIN will give you an easier migration path.
If Cygwin can't be used, you start here. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|