Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-21-2003, 04:53 PM   #1
LQ Newbie
Registered: Jul 2003
Posts: 14

Rep: Reputation: 0
Weird "\n" problem

OK, here is a fun one. I have a shell-script program that was written on Slackware 2.0 or previous kernel. I have installed this same exact program on a Slackware 9.0 system. The original system that was configured acts a little differently than the new system, but I do not know if this is because of the version difference of Slackware or some user environment setting or other environment flag that has been configured on the old system.

Here is what is going on. The program has a line in it as follows:

/bin/echo "NR==1{printf\"%4.0f \",\$1}NR==2{printf \" %4.0f \",\$1}NR==3{printf \" %4.2f \",\$1}NR==4{printf \" %10.2f \",\$0*$qty}NR==5{printf \" ID%04.0f \"\$0\" ~ $qty @ %2.2f\\\n\",$inum,$amount } " >/tmp/rmenu/awkit

I know, I know, what a mess. But, the important piece is the last line, "...2.2f\\\n\",$inum,$amount..."

The output of this on the original system looks like this:

6 3 0.10 100.00 ID0006 ITEM 6 ~1 @ 100.00

The output of this on the new system looks like this:

6 3 0.10 100.00 ID0006 ITEM 6 ~1 @ 100.00\n

Note the "\n" tacked on the end. For the life of me, I cannot figure out why this is doing one thing on the original system and another on the new system. Can anyone provide any insight whatsoever into what is going on here? It is the EXACT same code running on both systems. The only differences are the version of Slackware and whatever environment settings may have been set by the guy who wrote the program (who is now dead, so I cannot ask him)

Any feedback on this is GREATLY appreciated.
Old 08-21-2003, 05:38 PM   #2
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
I don't have either version of Slackware, so I can't test this. I would assume it's simply a different parsing routine between different version of whatever interpreter you're using (bash, tcsh, perl, or whatever). I would be willing to bet you simply need to remove one of the backslashes to get it to run on the newer system.

If that "fix" works, but don't like the idea of having two different version floating around, you'll have to make the script smart enough to find out what version of Slack it's running on, and execute the appropriate version of the command


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Debian Boot Up Problem - stuck at "BR" & "I" jc70417 Debian 2 08-30-2005 04:36 PM
problem "make"ing gtk+ "/usr/bin/env: perl -w" caid Linux - Newbie 8 07-29-2005 04:51 AM
Weird FTP "problem" akilles Linux - Networking 2 05-27-2005 02:26 AM
Sound problem with "alsamixer" or "alsaconf" or sth else maybe... Mikuda Linux - Games 4 05-01-2004 11:09 AM
Weird problem with "single" mode peeples Linux From Scratch 4 04-20-2004 03:02 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:54 AM.

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