Help cannot concatenate Ksh variables ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help cannot concatenate Ksh variables ?
# 8  
Old 02-20-2012
Don't know why it wouldn't. What shell are you using?

echo "svn relocate " $OldRepo " " $NewRepo
echo "svn relocate ${OldRepo} ${NewRepo} " should work also.
# 9  
Old 02-20-2012
to find path and create file pathList.dat file
Code:
find /webdata/tmpDNAbld -type d -exec sh -c '[ -d "$1"/.svn ] || exit 1' sh {} \; -print | cat > pathList.dat

what the "entries file" looks like (where hostname is located) we are only interested in the second URL line
Code:
8

dir
5254
https://Oldhostname/oldpath1/svn/oldpath2/NBH-HMS-HealthPromotion/tags/hp_rewrite/WebApp/Views/Account
https://Oldhostname/oldpath1/svn/oldpath2/NBH-HMS-HealthPromotion

... snip

---------- Post updated at 01:43 PM ---------- Previous update was at 01:41 PM ----------

Quote:
Originally Posted by bsrepellant
Don't know why it wouldn't. What shell are you using?

echo "svn relocate " $OldRepo " " $NewRepo
echo "svn relocate ${OldRepo} ${NewRepo} " should work also.

ksh

Last edited by methyl; 02-23-2012 at 03:03 PM.. Reason: make url visible
# 10  
Old 02-20-2012
@pcpinkerton
That doesn't look like the output of a sample:
Code:
sed -n l ./svn/entries

The format of these files is probably the problem. We need to see the control codes before a screen driver interprets them.
The "sed" is just designed to make control codes visible. When displayed by this method a normal unix line terminator shows as a dollar sign. Because these files came from a MAC they may contain carriage-return characters.

Last edited by methyl; 02-20-2012 at 03:12 PM..
# 11  
Old 02-20-2012
There was no confirmation from methyl's post about the missing backticks that assign the variables. Make sure this is not a typo.
# 12  
Old 02-20-2012
Quote:
Originally Posted by methyl
We'd still like to see a sample of the ".svn/entries" file displayed with the "sed" I mentioned earlier. This would tell us what the line terminators are in this file and whether it is a recognisable text file format.

Further to bsrepellant, I suspect that we'll need to remove carriage-return characters (\r) not linefeed characters (\n).


With a bit of lateral thought we can use the same sed display to show what the script is actually outputting (rather than what it looks like on the screen):
Code:
./scriptname   |  sed -n l

results:
Code:
cd /path/to/destin\
ation$   
svn relocate OldUrl/path/destin\
ationNewUrl/path/destination$

seems a next line is inserted and no space between first destination and URL

2nd line terminated with $

---------- Post updated at 02:55 PM ---------- Previous update was at 02:41 PM ----------

Quote:
Originally Posted by bsrepellant
There was no confirmation from methyl's post about the missing backticks that assign the variables. Make sure this is not a typo.
What is a backtick ?

Last edited by Scott; 02-22-2012 at 02:22 PM.. Reason: Code tags
# 13  
Old 02-20-2012
The character left of the 1 key.
Example:
OldRepo=`grep Oldhostname ${i}/.svn/entries | tail -1`
# 14  
Old 02-20-2012
Quote:
for i in `cat /scripts/pathList.dat`
Script line 1 contains two left quote characters. These are known in unix shell scripting as "backticks". In your ksh the code between the backticks is executed and the results placed on the command line.
Script lines 3 and 4 contain space characters where I would expect to see backticks.
Code:
variable=`command string`

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Concatenate two variables and form the third variable

Hi Guys, I was scratching my head for this for half a day... finally not successful :confused: Following is the problem I have a variable $ var1=123 $ var2-234 $ var3=345 and another Variable $ i=1 Now i wanted to save these into a Variable as shown below for i in 1 2 3 do... (5 Replies)
Discussion started by: ramprabhum
5 Replies

2. UNIX for Dummies Questions & Answers

Formating variables in KSH

Hi Friends , I want to know how to format the output for the following: i searched in the forum and couldnt get the exact requirement. Thanks in advance . (2 Replies)
Discussion started by: i150371485
2 Replies

3. Shell Programming and Scripting

concatenate variables

I need to know how to concatenate variables in Debian. I am making a interactive script where it ask the user for info to add a user I pull the first letter from the first middle and last name into individual variables now i want to put them all in one variable so i can put it into useradd command ... (4 Replies)
Discussion started by: HackerSeabass
4 Replies

4. Shell Programming and Scripting

ksh - for loop with variables

Hi, I 'm trying to send an e-mail for every different line in the .txt for i in {1..$variable} do sed -n "/$i$/p" text.txt done I have two problems about this. First one is that for loop doesn't work and the second one is that i cant get the output of sed (4 Replies)
Discussion started by: ozum
4 Replies

5. Shell Programming and Scripting

concatenate variables problem

Hello, I have a tricky problem: I have a $file with a variable number of occurrences of "ORA-" (in this case two) .......... EXP-00008: ORACLE error 3113 encountered ORA-03113: end-of-file on communication channel EXP-00056: ORACLE error 1403 encountered ORA-01403: no data found... (9 Replies)
Discussion started by: Laurentiu
9 Replies

6. Shell Programming and Scripting

Combining two variables in ksh

I can't believe I can't figure this out... given this code: CARS_DATA_LIST=`cat /tmp/file1 | awk '{print $1}' ` FMSA_DATA_LIST=`cat /tmp/file2 | awk '{print $1}' ` The value of each of the above variables is: CARS = a b c d e f g FMSA = a b c q r s I want to declare a third... (8 Replies)
Discussion started by: Shoeless_Mike
8 Replies

7. Shell Programming and Scripting

How to preserve NL in Ksh variables?

I'm trying to set a variable to the output of a command. This is what the comand output to the display looks like: />hciconndump -v TOsiu Dump of connection(s): TOsiu ---------------------------------------------------------------------- Process: A60Tsiu Connection: TOsiu... (2 Replies)
Discussion started by: troym72
2 Replies

8. Shell Programming and Scripting

how to concatenate values of two variables with an underscore(_) in between

Hi, I'm new to shell programming. I have two variables a and b a=val1 b=val2 could anyone kindly post the shell script to concatenate the values of variable a and b with an underscore(_) in between? The final output should be val1_val2. (8 Replies)
Discussion started by: badrimohanty
8 Replies

9. Shell Programming and Scripting

subtracting variables in ksh

hi all, how do i subract variables in shell ?? am trying to space out the headers and the output generated by the shell so they all line up : currently the output is like this : servers : users server1 : 10 latestServer : 50 so i thought... (3 Replies)
Discussion started by: cesarNZ
3 Replies

10. Shell Programming and Scripting

variables in ksh

I'm new to unix scripting. How would I go about pulling the first 3 characters from a variable in ksh and storing in another variable? Thanks. (9 Replies)
Discussion started by: steve6368
9 Replies
Login or Register to Ask a Question