Script exits when using UNIX2dos / dos2UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script exits when using UNIX2dos / dos2UNIX
# 1  
Old 11-20-2016
Question 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. SmilieSmilieSmilie

How do a fix it?

Code:
LOG_FILE=MADDY.txt

unix2dos ${LOG_FILE}

exec 2> $LOG_FILE 1>&2

echo ${LOG_FILE}

The script exists after the below message

Code:
unix2dos: converting file MADDY.txt to DOS format ...


Last edited by machomaddy; 11-21-2016 at 12:02 AM..
# 2  
Old 11-21-2016
With above commands in the script, the only result should be file MADDY.txt holding the string "MADDY.txt", no <CR> added.
# 3  
Old 11-21-2016
Adding to what RudiC said: Why are you modifying MADDY.txt, when you throw away the modifications afterwards anyway (with your echo statement)?
# 4  
Old 11-21-2016
It is unclear what you are trying to accomplish.
Please explain what you are trying to do.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash script to compare file all the files exits or not

Currently i am building a script like based on region parameter it will filter the records in config file and then it will create a text file like ab.txt and it will read the path location in that file and now i need to compare the files name in the config file to files in the path of the config... (1 Reply)
Discussion started by: saranath
1 Replies

2. UNIX for Beginners Questions & Answers

Script to check if files exits

Hi In live system core files are generating frequently. around 10 core files in 30 mins in root file system. which is eating my space very much below is core file core.56539 core.78886 core.12302 core.80554 core.20147 I am trying to write a script which should move... (7 Replies)
Discussion started by: scriptor
7 Replies

3. UNIX for Dummies Questions & Answers

Script dosent exits after executing the script

Hi i wrote a script which dosent exists after executing any help #!/bin/bash netstat -ptlen | grep 10000 if ; then echo "Hive Thrift server is running" exit 0 else echo "Hive Thrift server is down Trying to Bring up the service" | mail -s "ALERT" team@domain.com `nohup hive... (7 Replies)
Discussion started by: vikatakavi
7 Replies

4. Shell Programming and Scripting

Issue regarding dos2unix perl script

Hi All, I have pearl script which will check and convert the file: INFO("dos2unix_cmds".$#{$dos2unix_cmds}); if ( $#{$dos2unix_cmds} == 0 ) { my $convert_cmd = $$dos2unix_cmds; my $rename_cmd = $$dos2unix_cmds; --conversion going here else INFO ("No need to... (8 Replies)
Discussion started by: saps19
8 Replies

5. Shell Programming and Scripting

'script' command exits immediately

I'm trying to capture the output of some commands with the 'script' utility. Normally, I would type 'script /path/to/output/file', then enter commands, then hit ctrl+D to end the 'script' capture. I'm having trouble with it on a server. Upon starting 'script', it exits immediately before I type... (6 Replies)
Discussion started by: jalburger
6 Replies

6. Shell Programming and Scripting

Exits from putty instead of shell script

Dear, I have written below code to initiate the log at top of my script. #Set the log file LOGFILE=<path>/<filename.log> exec > $LOGFILE 2>&1 ............... .... ... .. ............ echo -e "\n\n Script finished OK " `date "+%m/%d/%y %H:%M:%S" ` "\n\n" exit 0 the logging ends only... (14 Replies)
Discussion started by: Imran_Chennai
14 Replies

7. 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

8. Windows & DOS: Issues & Discussions

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 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... (1 Reply)
Discussion started by: karthiksrao
1 Replies

9. UNIX for Dummies Questions & Answers

dos2unix - editing script - Help Urgent Please

Hi this is my first time on this forum so sorry if I posted this to the wrong area. I need help with the following. I have a basic FormMail cgi script I use. When I upload the script using filezilla, there is one line in the script that changes. The line should read &get_date; instead it... (2 Replies)
Discussion started by: lydp101
2 Replies

10. Shell Programming and Scripting

Script exits with $? not 0 randomly, how can I see what command failed?

Hi! I have this situation with 3 shellscripts. One is a "startscript" that simply calls other scripts. This one is scheduled with cron to run at regular intervals. That script runs what I'll refer to as Script 1. Script 1 in turn runs script 2 (import_catalogs_buyer.sh) Sometimes, seemingly... (2 Replies)
Discussion started by: trailsmoke
2 Replies
Login or Register to Ask a Question