Sponsored Content
Operating Systems Linux SuSE Need to assign value to a variable and export it at the same time Post 302727841 by RomitaaChawla@1 on Wednesday 7th of November 2012 02:15:22 AM
Old 11-07-2012
Thank you Guru and Ningy. I can now save and export it.

But how do I use the value of this exported variable from outside of the script.

i.e. when I exit the script and do a echo $CUSTOMER_ID, I do not see '999'.

---------- Post updated at 02:15 AM ---------- Previous update was at 01:57 AM ----------

Well .. now I can use the exported value globally by running script like below

. tool.sh
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Assign time value

I'm trying to monitor the traffic for few hours but still don't know how to make it possible. I try to set the value of time HH MM SS each into variables but for Hour, there's an error occurred as follow. typeset -i hour=$(date +%H) typeset: 09: value too great for base (error token is "09") ... (2 Replies)
Discussion started by: phragix
2 Replies

2. UNIX for Dummies Questions & Answers

Export command giving Variable Name vs the Value set for the Variable

I'm having an issue when I export within my program. I'm getting the variable name, not the variable value. I have a configuration file (config.txt) that has the values of the variables set as so: set -a export ARCHIVEPOSourceDir="/interfaces/po/log /interfaces/po/data" export... (2 Replies)
Discussion started by: ParNone
2 Replies

3. Shell Programming and Scripting

Export Variable

How to export variable from one script to other? Can anybody give me syntax for that? Thanks (2 Replies)
Discussion started by: navi
2 Replies

4. Shell Programming and Scripting

assign awk's variable to shell script's variable?

Dear All, we have a command output which looks like : Total 200 queues in 30000 Kbytes and we're going to get "200" and "30000" for further process. currently, i'm using : numA=echo $OUTPUT | awk '{print $2}' numB=echo $OUTPUT | awk '{print $5}' my question is : can I use just one... (4 Replies)
Discussion started by: tiger2000
4 Replies

5. Shell Programming and Scripting

Shell assign variable to another variable

How can I assign a variable to an variable. IE $car=honda One way I can do it is export $car=honda or let $car=2323 Is there any other ways to preform this task (3 Replies)
Discussion started by: 3junior
3 Replies

6. Shell Programming and Scripting

Export variable

Hi I have a pass a variable from one script to another. Here are my scripts Script #1 ./profile #!/bin/sh export NAME="Hello" Script #2 ./test #!/bin/sh ./profile echo $NAME when I run ./test .. i am not getting anything .. why is that? (5 Replies)
Discussion started by: arex876
5 Replies

7. UNIX for Advanced & Expert Users

Need help export variable

Hi, Please find my code below. ps -xef | grep 14766 | awk 'BEGIN{X="java_home=";X="weblogic_home="} {for(i=1;i<=NF;i++){if($i ~ /-Dplatform\.home|java$/){split($i,P,"=");s=P?P:$i;print X""s}}}' echo "java_home="$java_home echo "weblogic_home="$weblogic_home Output: Why does... (3 Replies)
Discussion started by: mohtashims
3 Replies

8. UNIX for Beginners Questions & Answers

Need to pass variable in a command and assign value to a variable

Hello All, Hope you're doing well ! I am trying below command to be passed in a shell script, header_date_14 is a variable and $1 is the name of a file I intend to pass as a command line argument, however command line argument is not being accepted. header_date_14=$(m_dump... (8 Replies)
Discussion started by: ektubbe
8 Replies

9. UNIX for Beginners Questions & Answers

How can I assign awk's variable to shell script's variable?

I have the following script, and I want to assign the output ($10 and $5) from awk to N and L: grdinfo data.grd | awk '{print $10,$5}'| read N L output from gridinfo data.grd is: data.grd 50 100 41 82 -2796 6944 0.016 0.016 3001 2461. where N and L is suppose to be 3001 and 100. I use... (8 Replies)
Discussion started by: geomarine
8 Replies
NANOSLEEP(2)						     Linux Programmer's Manual						      NANOSLEEP(2)

NAME
nanosleep - pause execution for a specified time SYNOPSIS
#include <time.h> int nanosleep(const struct timespec *req, struct timespec *rem); DESCRIPTION
nanosleep delays the execution of the program for at least the time specified in *req. The function can return earlier if a signal has been delivered to the process. In this case, it returns -1, sets errno to EINTR, and writes the remaining time into the structure pointed to by rem unless rem is NULL. The value of *rem can then be used to call nanosleep again and complete the specified pause. The structure timespec is used to specify intervals of time with nanosecond precision. It is specified in <time.h> and has the form struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; The value of the nanoseconds field must be in the range 0 to 999 999 999. Compared to sleep(3) and usleep(3), nanosleep has the advantage of not affecting any signals, it is standardized by POSIX, it provides higher timing resolution, and it allows to continue a sleep that has been interrupted by a signal more easily. ERRORS
In case of an error or exception, the nanosleep system call returns -1 instead of 0 and sets errno to one of the following values: EINTR The pause has been interrupted by a non-blocked signal that was delivered to the process. The remaining sleep time has been written into *rem so that the process can easily call nanosleep again and continue with the pause. EINVAL The value in the tv_nsec field was not in the range 0 to 999 999 999 or tv_sec was negative. BUGS
The current implementation of nanosleep is based on the normal kernel timer mechanism, which has a resolution of 1/HZ s (i.e, 10 ms on Linux/i386 and 1 ms on Linux/Alpha). Therefore, nanosleep pauses always for at least the specified time, however it can take up to 10 ms longer than specified until the process becomes runnable again. For the same reason, the value returned in case of a delivered signal in *rem is usually rounded to the next larger multiple of 1/HZ s. As some applications require much more precise pauses (e.g., in order to control some time-critical hardware), nanosleep is also capable of short high-precision pauses. If the process is scheduled under a real-time policy like SCHED_FIFO or SCHED_RR, then pauses of up to 2 ms will be performed as busy waits with microsecond precision. CONFORMING TO
POSIX.1b (formerly POSIX.4). SEE ALSO
sleep(3), usleep(3), sched_setscheduler(2), timer_create(2) Linux 1.3.85 1996-04-10 NANOSLEEP(2)
All times are GMT -4. The time now is 05:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy