LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 02-13-2008, 08:41 PM   #1
pingpong
LQ Newbie
 
Registered: Feb 2008
Posts: 1

Rep: Reputation: 0
Thumbs up script issues from suse to RHEL5 AS


We recently migrated one server from SUSE OS to RHEL5. The problem is the shell scripts do not produce the desired outcome on the command line the output does not have any issues. Example:- S1=`cat $FILE1|grep -v /|grep [0-9]` from the prompt echo $S1 is 129 but code when fired in a script using bash or ksh outputs S1=$'129\r'. The same has been working fine on SUSE OS. Does this have to do with user profile/env etc?

Thnaks in advance for any valuable input
 
Old 02-14-2008, 06:17 AM   #2
doublejoon
Member
 
Registered: Oct 2003
Location: King George, VA
Distribution: RHEL/CentOS/Scientific/Fedora, LinuxMint
Posts: 370

Rep: Reputation: 44
Quote:
Originally Posted by pingpong View Post
We recently migrated one server from SUSE OS to RHEL5. The problem is the shell scripts do not produce the desired outcome on the command line the output does not have any issues. Example:- S1=`cat $FILE1|grep -v /|grep [0-9]` from the prompt echo $S1 is 129 but code when fired in a script using bash or ksh outputs S1=$'129\r'. The same has been working fine on SUSE OS. Does this have to do with user profile/env etc?

Thnaks in advance for any valuable input

Try
Code:
S1=$(/bin/cat $FILE1|/bin/grep -v /|/bin/grep [0-9])
I think the shell is trying to interpret those special characters in the command line substitution
So try the following for that

Code:
/bin/echo ${S1}

Last edited by doublejoon; 02-14-2008 at 06:24 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
issues with mirc script accessing our php script dtra Linux - Software 2 07-02-2005 04:30 PM
script issues rand0mh3ro Linux - Software 4 12-10-2004 05:33 AM
Script Issues skguha Linux - Newbie 1 03-23-2004 03:40 AM
C shell script issues daveb93 Linux - Software 3 10-17-2003 08:19 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 05:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration