Problem in understanding export uses


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem in understanding export uses
# 8  
Old 07-10-2012
first of all thx to Jlliagre.

Hi PIKK45
i made the below changes but not i am getting dollar sign as a o/p ($)
Code:
PS1=${HOST:=`uname -n`}"$ " ; export PS1 HOST ;


Last edited by methyl; 07-10-2012 at 08:12 AM.. Reason: Please use code tags
# 9  
Old 07-10-2012
Can you please post the OS, kind of shell that you are using?

Smilie
# 10  
Old 07-10-2012
hi Pikk45

correction done but now getting dollar sign ($) as a o/p.

Code:
PS1=${HOST:=`uname -n`}"$ " ; export PS1 HOST ;

---------- Post updated at 12:50 PM ---------- Previous update was at 12:47 PM ----------

os is AIX

Code:
 echo $0
-ksh
shell is ksh


Last edited by methyl; 07-10-2012 at 08:12 AM.. Reason: code tags
# 11  
Old 07-10-2012
@Scriptor, I am also using AIX 5.3 and ksh.

My script is as below
Code:
#! /bin/ksh
PS1=${HOST:=`uname -n`}"$"; export PS1 HOST;
echo "PS1=$PS1"
echo "HOST=$HOST"
exit

I run this from Xtreme_works server. And the output is
Code:
PS1=Xtreme_works$
HOST=Xtreme_works

I can't understand why is your script giving just $ Smilie
# 12  
Old 07-10-2012
first of all thx for ur help.

by adding ur lines
Code:
echo "PS1=$PS1" echo "HOST=$HOST"

i am getting the o/p but y the dollar sign is coming in o/p
also why echo $PS1 was not working correctly.
Code:
PS1=az91cp01$ 
HOST=az91cp01


Last edited by methyl; 07-10-2012 at 08:13 AM..
# 13  
Old 07-10-2012
Can you please post your script for us to analyze?

Along with the lines where you executed it and the incorrect output.

Thanks Smilie
# 14  
Old 07-10-2012
Quote:
Originally Posted by PikK45
@Scriptor, I am also using AIX 5.3 and ksh.

My script is as below
Code:
#! /bin/ksh
PS1=${HOST:=`uname -n`}"$"; export PS1 HOST;
echo "PS1=$PS1"
echo "HOST=$HOST"
exit

I run this from Xtreme_works server. And the output is
Code:
PS1=Xtreme_works$
HOST=Xtreme_works

I can't understand why is your script giving just $ Smilie
see above red one because of that $ is coming at the end of the line..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with (Understanding) function

I have this code #!/bin/bash LZ () { RETVAL="\n$(date +%Y-%m-%d_%H-%M-%S) --- " return RETVAL } echo -e $LZ"Test" sleep 3 echo -e $LZ"Test" which I want to use to make logentrys on my NAS. I expect of this code that there would be output like 2017-03-07_11-00-00 --- Test (4 Replies)
Discussion started by: matrois
4 Replies

2. Shell Programming and Scripting

Problem in understanding debugging

Hi i was going through the script debugging technique. below example was given in the book. 1 #!/bin/sh 2 3 Failed() { 4 if ; then 5 echo "Failed. Exiting." ; exit 1 ; 6 fi 7 echo "Done." 8 } 9 10 echo "Deleting old backups,... (11 Replies)
Discussion started by: scriptor
11 Replies

3. Shell Programming and Scripting

Problem on understanding the regexp command

Hi all, I'm not clear of this regexp command: regexp {(\S+)\/+$} $String match GetString From my observation and testing, if $String is abc/def/gh $GetString will be abc/def I don't understand how the /gh in $String got eliminated. Please help. Thanks (2 Replies)
Discussion started by: mar85
2 Replies

4. UNIX for Dummies Questions & Answers

Problem understanding Paths

If I don't explain my issue well enough, I apologize ahead of time, extreme newbie here to scripting. I'm currently learning scripting from books and have moved on to the text Wicked Cool Shell Scripts by Dave Taylor, but there are still basic concepts that I'm having trouble understanding. ... (10 Replies)
Discussion started by: Chasman78
10 Replies

5. Red Hat

Understanding local access to NFS export

Hello, I've inherited an NFS setup that allows external servers to write to an NFS share on a Centos box. Here is an example line from /etc/exports (there are four entries that only are different based on server IP adress). /exports/foobar... (4 Replies)
Discussion started by: KickstartUF
4 Replies

6. UNIX for Dummies Questions & Answers

Problem with export command

hello all, I know this is a silly question but i have no answer. I have a shell script temp.ksh export value="mynh" echo $value but when i execute the temp.ksh "mynh" is printed but when i give echo $value in the shell after the program is executed, nothing is printed. ... (3 Replies)
Discussion started by: anijan
3 Replies

7. Shell Programming and Scripting

Problem in scheduling an Export of a table

Hi, I am facing a problem while scheduling an export of a table using cron job. I have written a simple export command inside a shell script test.sh like echo started exp schemaname/temp1234 file= /test/d.dmp tables=per_st log= /test/d.log echo ended I tried scheduling it through... (6 Replies)
Discussion started by: beautifulmind
6 Replies

8. Shell Programming and Scripting

egrep understanding problem

Hi, Can anyone please let me know the meaning of this line,i am not able to understand the egrep part(egrep '^{1,2}).This will search for this combination in beginning but what does the values in {}signifies here. /bin/echo $WhenToRun | egrep '^{1,2}:$' >/dev/null (1 Reply)
Discussion started by: namishtiwari
1 Replies

9. UNIX for Dummies Questions & Answers

problem with EXPORT

hi, :) I created a main script called "Paymain.prg" ( /proj/paymain.prg) In this script i created two variables as follows MASTER=/HOME/emaster.dbf TRAN=/HOME/etran.dbf Aftre that i exported that two variables EXPORT MASTER TRAN But when i use these two variable in another script calld... (3 Replies)
Discussion started by: ravi raj kumar
3 Replies

10. Shell Programming and Scripting

Beginner export problem

Me dumb. Can't get this to work... #!/bin/sh export JAVA_HOME_BAK=${JAVA_HOME} or #!/bin/sh export JAVA_HOME_BAK=/usr/java or #!/bin/sh export JAVA_HOME_BAK=$JAVA_HOME or #!/bin/sh export JAVA_HOME_BAK $JAVA_HOME etc.... none work. Either i get: "JAVA_HOME_BAK=/usr/java: is not... (1 Reply)
Discussion started by: xplodersuv
1 Replies
Login or Register to Ask a Question