RHEL7 dos2UNIX return code 13


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat RHEL7 dos2UNIX return code 13
# 1  
Old 01-11-2019
RHEL7 dos2UNIX return code 13

Hi, upgraded one of the server to RHEL7. A Shell script uses dos2unix to convert EOL characters to Linux format and checks return code. In RHEL6, if conversion fails shell script returns code 1 where as if conversion fails in RHEL7 script returns return code 13. Is it possible to change RHEL7 return code(13) as in RHEL6 (1) ?

Code:
[satya@rhel6 tmp]$ cat /etc/redhat-release
Red Hat Linux release 6.x
[satya@rhel6 tmp]$ dos2unix testfile
dos2unix: converting file testfile to UNIX format ...
dos2unix: problems converting file testfile
[satya@rhel6 tmp]$ echo $?
1
[satya@rhel6 tmp]$

Code:
[satya@rhel7 tmp]$ cat /etc/redhat-release
Red Hat Linux release 7.x
[satya@rhel7 tmp]$ dos2unix testfile
dos2unix: testfile: Permission denied
dos2unix: converting file testfile to Unix format ...
dos2unix: problems converting file testfile
[satya@rhel7 tmp]$ echo $?
13
[satya@rhel7 tmp]$



thanks
satya

Last edited by Neo; 01-11-2019 at 12:59 AM.. Reason: Added Code Tag and Gave Code Tag Warning to User. Please read the rules. They are important.
# 2  
Old 01-11-2019
These commands should help
Code:
file testfile
stat testfile
enca testfile

--- Post updated at 10:12 ---

I apologize for the previous post, I did not understand the question, but what does the next command output give here and there?
Code:
dos2unix -i testfile

The point is not in the dos2unix utility but in the file permissions.
I changed the file permissions and got the same error code from any utility!
Code:
chmod 444 file
echo "hi" > file
Permission denied


Last edited by nezabudka; 01-11-2019 at 06:29 AM..
# 3  
Old 01-11-2019
What be the output of dos2unix -V on either system?
# 4  
Old 01-11-2019
Thank you for the reply. Java application executes dos2unix on linux box and look for return codes 0(success) or 1(fail). As failure return code changed in RHEL7, java app code failing. so want to get some idea on whether this 13 return code coming from linux or dos2unix utlity.

--- Post updated at 08:34 PM ---

Thank you RudiC, here is the o/p from RHEL7 and RHEL6. Java application executes dos2unix on linux box and look for return codes 0(success) or 1(fail). As failure return code changed in RHEL7, java app code failing. so want to get some idea on whether this 13 return code coming from linux or dos2unix utlity.

Code:
[satya@rhel7 tmp]$ dos2unix -V
dos2unix 6.0.3 (2013-01-25)


[satya@rhel6 ~]$ dos2unix -V
dos2unix 3.1 (Thu Nov 19 1998)


Last edited by Neo; 01-12-2019 at 10:10 AM.. Reason: Code Tags
# 5  
Old 01-11-2019
The java code is wrong. The standards say that exit code 0 is success and that failure is denoted by a non-zero value (not just 1). Some utilities have other non-zero exit values that still indicate success, but no program should assume that only exit code 1 means failure.

The standards also specify that the some utilities are required to return exit code 126 if an attempt was made to invoke a utility, a utility by that name was found, but the utility was not in the proper form to execute as a utility and to return exit code 127 if an attempt was made to invoke a utility but no utility of the desired name was found.
# 6  
Old 01-12-2019
First, make sure the two versions react differently to the identical error situation, which is not obvious in post #1. Are both running into the "permission denied" error? If that's the case, and you can't make the java code behave, consider installing the older dos2unix version on the RHEL7 system.
# 7  
Old 01-13-2019
Still as an option to check access by acl and entry into groups
Code:
getacl
groups

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Looking for equivalent of Solaris containers/zones in RHEL7 Linux

Hi, I come from a legacy Solaris background with lots of experience with Solaris Containers/zones that we use for network and process isolation from each other. Currently we have a RHEL7 Linux VM running on VMWare, but we would like to segment that VM with some form of containers and achieve... (1 Reply)
Discussion started by: ckmehta
1 Replies

2. Red Hat

RHEL7 - Samba

I'm having trouble with a Linux Samba share after migrating a system from RHEL 5 to RHEL 7. My current configuration is below. workgroup = DOCS security = share comment = Data path = /export read only = yes guest ok = yes browsable = yes In RHEL7 the service will fail to... (1 Reply)
Discussion started by: christr
1 Replies

3. Solaris

Instructions for Solaris 10 RedHat RHEL7 IPA for LDAP authentication?

Hi, does anyone have instructions on how to connect a Solaris 10 (Sparc) machine to Redhat RHEL7 IPA server for LDAP authentication, I have gone through the usual search results on Google, but nothing is working so far, but to be fair, not sure which source is the best and have NOT rewound... (3 Replies)
Discussion started by: ckmehta
3 Replies

4. Red Hat

Command for viewing hba cards on rhel7

hi all, I am trying to view the hba cards on a rhel7 server (storage says they are there, but I am not seeing them. I tried lspci -nn | grep -i hba lspci |grep qla I tried looking in /sys/class/fc_host.. but it is empty. I am not sure if I am looking in the right spot... (0 Replies)
Discussion started by: gartie
0 Replies

5. Red Hat

How to sync time with bios in rhel7?

Hi All, I deployed the rhel7 server in the bare metal hardware. I want to configure the rhel7 server to sync time with bios. I tired the below commands. Still it did not sync the time with bios. Thanks, Kalai (3 Replies)
Discussion started by: kalpeer
3 Replies

6. Shell Programming and Scripting

Return for Dos2UNIX

Hi, I have to test to see if dos2unix is installed on the machine. Right now I am typing in dos2unix and hitting ctrl C. Is there a better workaround for this. If dos2unix is there is need to print the statement saying its there and vice versa. How can i accomplish this. thank you in... (1 Reply)
Discussion started by: tarreddy
1 Replies

7. UNIX for Dummies Questions & Answers

return value of dos2unix

if (my $temp2=$b2e_r->cmd(cmd=>"dos2unix $b2e_file_name")) Even if it fails as, Jul 25 17:17:02 dos2unix /volume/systest/hello_manoj.results dos2unix /volume/systest/hello_manoj.results dos2unix: converting file /volume/systest/hello_manoj.results to UNIX format ... Failed to open... (3 Replies)
Discussion started by: manojn
3 Replies

8. Shell Programming and Scripting

Need help with return code 1...

Hi Guys,, I am having a unix script which is running the DB2 Insert command. For the insert command, there were no records to be updated. SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table. SQLSTATE=02000 + + echo 1 STAGE_RC=1 + ] ... (6 Replies)
Discussion started by: mac4rfree
6 Replies

9. UNIX for Dummies Questions & Answers

to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's

Hi All, Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'. I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies

10. UNIX for Advanced & Expert Users

Return code from PL/SQL Code

Hi Guys, I was just wondering if anybody can help me with this problem. OK, how we can get a value back from PL/SQL Script (not stored procedure/function) See the below example: (for example aaa.sh) #!/bin/ksh VALUE=`sqlplus -s user/password@test_id <<EOF @xxx.sq EOF` echo $VALUE ... (7 Replies)
Discussion started by: Shaz
7 Replies
Login or Register to Ask a Question