Welcome Guest ( Log In | Register )

Bump Topic Topic Closed RSS Feed

Outline · [ Standard ] · Linear+

 shell script, simple script

views
     
TSnxfx
post Jun 1 2005, 05:11 PM, updated 21y ago

Enthusiast
*****
Senior Member
979 posts

Joined: Jan 2003


Ok here im want to do. i have a string and concat/append another string using a loop

the pseudocode

for 1 to 3
str1 = str1 + "A"
end for

The result would be "AAA"

any idea on how to do this using unix korn shell script
any idea is much appreciated



This post has been edited by nxfx: Jun 1 2005, 05:32 PM
nameless
post Jun 1 2005, 07:32 PM

On my way
****
Senior Member
623 posts

Joined: Jan 2003


CODE

#!/bin/bash
string=""
for ((  i = 0;  i < 3;  i++  ))
do
string=$string"A"
done
echo $string

There too many online Unix shell Scripting Tutorial,
try Google around.
kons
post Jun 1 2005, 08:43 PM

Конс
Group Icon
Moderator
6,181 posts

Joined: Oct 2004



QUOTE("nameless")
There too many online Unix shell Scripting Tutorial,
try Google around.


Seems like bourne again shell to me...
the for loop in korn shell isn't like that... as far as I can remember.
TSnxfx
post Jun 2 2005, 01:08 PM

Enthusiast
*****
Senior Member
979 posts

Joined: Jan 2003


sokay.. figured it out.
thanx anyway.

Topic ClosedOptions
 

Change to:
| Lo-Fi Version
0.0121sec    0.99    5 queries    GZIP Disabled
Time is now: 25th December 2025 - 12:42 AM