unix script and unix2dos conversion

 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions unix script and unix2dos conversion
# 1  
Old 06-11-2009
unix script and unix2dos conversion

Hi,
I am a newbie and do not have much experience using unix. But I have been trying to understand it. I found the following unix script

typeset -i n=0

while [! -s vel.txt]
do
sleep 5
echo "${n}:Fluent is running...."
n=${n}+1
done

I have the following doubts:
1) In the first line - I am aware that we are defining a variable n and setting its value to zero. What does the '-i' do ?

2) Does the while loop say that while vel.txt does NOT exist, keep printing "Fluent is running..." ? What does the '-s' stand for?

3) I need to convert this to DOS batch script..
Is the following, a correct translation ?

SET n=0
WHILE NOT vel.txt
DO
SLEEP 5
ECHO "%{n}% : Fluent is running..."
n = %{n}% + 1
DONE

Any help will be much appreciated.


Thanks
# 2  
Old 06-11-2009
Quote:
Originally Posted by karthiksrao
Hi,
I am a newbie and do not have much experience using unix. But I have been trying to understand it. I found the following unix script

typeset -i n=0
decalre an integer variable n
while [! -s vel.txt] vel.txt exists and is bigger than zero bytes read man page for test
do
sleep 5
echo "${n}:Fluent is running...."
n=${n}+1
done

I have the following doubts:
1) In the first line - I am aware that we are defining a variable n and setting its value to zero. What does the '-i' do ?

2) Does the while loop say that while vel.txt does NOT exist, keep printing "Fluent is running..." ? What does the '-s' stand for?

3) I need to convert this to DOS batch script..
Is the following, a correct translation ?
I have not done DOS for 15 years. It looks reasonable except
for the {} around the n. I do not remember that.


SET n=0
WHILE NOT vel.txt
DO
SLEEP 5
ECHO "%{n}% : Fluent is running..."
n = %{n}% + 1
DONE
Any help will be much appreciated.

Thanks
I added some comments in red.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

powershell script to unix shell script conversion.

Here is a powershell script to use restful API to create ticket in our ticketing tool. Can anyone please convert it to a shell script sothat, I can run it in Unix servers, below is the code: $body = @{ Customer= ''test' Summary= 'test summary' Impact= '4-Minor/Localized' ... (2 Replies)
Discussion started by: pandeybhavesh18
2 Replies

2. Shell Programming and Scripting

Script exits when using UNIX2dos / dos2UNIX

I'm not sure why but my script quits automatically at the point where unix2dos / dos2unix command is used. :confused::confused::confused: How do a fix it? LOG_FILE=MADDY.txt unix2dos ${LOG_FILE} exec 2> $LOG_FILE 1>&2 echo ${LOG_FILE} The script exists after the below... (3 Replies)
Discussion started by: machomaddy
3 Replies

3. Shell Programming and Scripting

unix2dos?

HI there ! can you please explain me about "unix2does" command like >> when we used ? what it does ? ... (3 Replies)
Discussion started by: sravan008
3 Replies

4. Shell Programming and Scripting

Using unix2dos command in the below script

Hi, Please help me in implemeting unix2dos command so that report output which comes as the attachment through mail is in the proper format Am using uuencode fro attaching one report which is nothing but sql query output. But when i receive the report through attachement and when it is... (2 Replies)
Discussion started by: weknowd
2 Replies

5. Shell Programming and Scripting

Command for unix to dos conversion

Dear All Could you please advice how do we convert a unix file to dos I know one command,ux2dos, which somehow does not work to give desired output Inputs on this is appreciated Thanks, Suresh (3 Replies)
Discussion started by: sureshg_sampat
3 Replies

6. Shell Programming and Scripting

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 ; then echo "UNCERTAIN:" echo "Too few arguments" echo "Usage: file_exists... (3 Replies)
Discussion started by: kiwi_bloke
3 Replies

7. Shell Programming and Scripting

Dos to Unix conversion

Hi ! I need to convert a DOS batch file to Unix Shell script. Can anybody help me by providing equivalent Unix shell script code to this DOS batch code?. for /F "tokens=2,3,4 delims=/- " %%i in ("%date%") do set DateStamp=%%k%%i%%j Any help would be great. Thanks, John. (1 Reply)
Discussion started by: john413
1 Replies

8. UNIX for Dummies Questions & Answers

Unix to EBCDIC conversion

Hi, I am using HPUX 11. There is a command to convert Unix formatted data to Dos formatted data called 'ux2dos'. Is there a similar command to convert Unix formatted data to EBCDIC format? Many thanks Helen :) (2 Replies)
Discussion started by: Bab00shka
2 Replies

9. Filesystems, Disks and Memory

unix to windows conversion

I have a pentium scsi with unix installed. It used to be a workstation in my former workplace. I'd like to install windows for my sons use but don't know unix and it's pw protected (don't know the pw). How can unix be deleted and windows put on? (2 Replies)
Discussion started by: misc19432043
2 Replies

10. UNIX for Advanced & Expert Users

Time conversion in Unix

Hi, Is there any way to get current time for a particular country using any unix command ? I mean, If i want to find out current time in US or UK or anything .... Any command or library routine available for that? How it can be done in C on Unix? Can anybody help me? Thanks --... (1 Reply)
Discussion started by: kamlakar
1 Replies
Login or Register to Ask a Question