Hi all.
Probably a silly question... :-(
This is my script.
This is the output.
The last line is not what I expect.:-(
Can someone help me to make a formattated output with 4 values in printf?
man printf does' t help me so much.. :-(
Thanks
Last edited by Scott; 04-14-2011 at 04:06 PM..
Reason: Code tags, please...
If the data you're working with uses windows style line-endings, \r\n, the \n is lost during shell parsing (field splitting, and in the terminating case command substitution as well) but the \r would remain. A terminating \r in the values stored in $a, $b, $c, or $d would yield the results you're seeing.
To illustrate:
It looks like 'Carriage -> ' was never printed, but it was (the ">" after 'Return' is from the arrow that follows 'Carriage'). It's just seems that way due to the how the terminal interprets the \r -- the cursor returns to column 1 of the same line and prior output on that line is overwritten with new output until the next newline moves the cursor to the next line. While some text may be clobbered on the screen, if the output were redirected to a file, inspecting it with a tool such as od(1) would show that all the data is indeed there. The \r is only a problem with regard to displaying/printing on a terminal (and possibly some printers).
To confirm, you could pipe the output of the script into od -c and look for carriage returns, \r. You could also try piping the output through tr -d \\r to see if that fixes the problem.
i=1
out=""
j=`expr 2 * $1`
while
do
out="$out"#""
echo $out
((i=i+1))
done
while
do
print ${out%?}
((i=i+1))
done
This script is throwing an error:
gurnish:/home/fnb/gurnish/saurabh/scripts> while1 3
expr: 0402-050 Syntax error.
# (6 Replies)
I've been busy and fell behind on Sun/Oracle. Forgive me if too basic. I welcome brief, cryptic, or advanced replies. I also welcome noobie information since I may have no clue what's up at the moment.
Problem statement:
I inherited a computer to set up. I would rather not figure out 8 months... (1 Reply)
Hello there....i am a final year comp science student.......i am thinking of doing my project on unix platform......which one do u suggest?thanx in advance... (3 Replies)
A few weeks ago at the recommendation of people I trust, I bought and started reading Kernighan and Ritchie's (K&R) C Programming Language. For one thing, it's damn thin compared to the O'Reilly Practical C I just finished last month. It covers generally the same stuff but in a much more... (9 Replies)
Hi,
I have written a script which calls a process which ends up in a reboot of the system. At the end of the reboot it prompts for login & i need to provide the login details. am not able to figure out hw to do this.
Doubt: will echoing login details after calling the process work?
for ex:... (1 Reply)
Hi all,
I have worked on HP UNIX and now i have moved to SunSolaris which i never used to work.
I am more on programming side like shell and perl scripting.
So i want to know from you experts that i need to take care or changes which i code in sun solaris in compared to HP unix.
Suggestions... (1 Reply)
We run WebSphere and by default it wants to install everything under /usr. While I can understand the default (everyone has a /usr) I would like to move this over to a dedicated volume group called apps and then setup my lv's and fs's here. Our WebSphere Admin doesn't like this because apparently... (1 Reply)
The current backup procedure we using a tar command in linux.
The files are stored in one partition in different folders. The docs stores in day wise folders like ex: /usr/data/xyz/20050129, /usr/data/xyz/20050130 .............etc
We using tar & gzip command to take backup everyday. The backup... (3 Replies)
All,
Have an AMD-K6/2 PC, 20G.Hd along with RH7.2.
Wanting to know what I should do in terms of setup (workstation/server) and then what I can do with it?
I'd like to learn a DBMS and SQL - can I do this using RedHat?
Any suggestions with how I can use/ what I can do with this appreciated. (3 Replies)
Hi all,
Have two SCO 5.0.5 systems and one Slackware(joy?) system.
I've been asked to backup all three systems onto a newly acquired AIT Tape drive that we've installed on one of the SCO boxes.
Using the existing cpio backup script on the one SCO works a treat and is really fast (which is... (2 Replies)