04-19-2009
variable exporting
Hi,
can anyone tell me the difference between the below two examples:
Eg-1:
# name=bravo
# echo $bravo
what would be the o/p
Eg-2:
# name1=jhonny
# export name1
# echo $name1
what would be the o/p
If the o/p's of both examples are the same then what is the use of the cmd export in Eg-2.
I know export will create an env variable temporarily, when I type the cmd "env" it will display the variable name1 and its value.
Can anyone give more specific info of what is going on in the background, and the real use of export.
Thanks in advance.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
How do I export a directory ?
I am trying to link the directory from another machine. (2 Replies)
Discussion started by: brv
2 Replies
2. UNIX for Dummies Questions & Answers
how do I export my display from my unix box to my pc
basically what is the syntax for export DISPLAY (2 Replies)
Discussion started by: csaunders
2 Replies
3. Windows & DOS: Issues & Discussions
My friend's boss has asked me to help update a customer database. They have a limited amount of space and have asked if I can do this from my home computer.
She is working on a Unix system with a program called Accuterm. My understanding is that this program is a dedicated program for the... (0 Replies)
Discussion started by: clearchoice
0 Replies
4. Shell Programming and Scripting
Hi,
I am exporting the environment variable from config file, but when I echo the variable it does not display any value. Here is the snippet of the code
#!/bin/sh
export ENVIRONMENT_ROOT_DIRECTORY="/cb/$ENVIRONMENT"
echo $ENVIRONMENT_ROOT_DIRECTORY
${JAVA_HOME}/bin/java... (2 Replies)
Discussion started by: bhavnabakshi
2 Replies
5. Shell Programming and Scripting
Here's how;
Say;
I have a variable VAR which contains something like MY_DIR=/apphome/some/mydir.
What I want is I want to export VAR so that it will vitually export MY_DIR. Please suggest me? (15 Replies)
Discussion started by: swmk
15 Replies
6. Shell Programming and Scripting
Can someone help me out to export awk output to excel file in different rows? Plzzzz its urgent...:( (4 Replies)
Discussion started by: goutam_igate
4 Replies
7. Shell Programming and Scripting
Even though the idea "might" not be great I still wrote this piece of code to get practice.. Which means that it is the CODE that matters here.
Anyways;
The intension is to create a program(or do we call it script?) that searches recursively through a folder to find a file - stored in a... (4 Replies)
Discussion started by: Pesk
4 Replies
8. Shell Programming and Scripting
Hi All;
I m working on a script and came across an issue ,to explain it briefly here is the sample code
echo $HOSTNAME|while read IN; do var=`echo $IN|awk -F "-" '{print $2}'`; export var; echo $var; done
now I get the value of $var but when it is out of the while loop
it does not return... (3 Replies)
Discussion started by: maverick_here
3 Replies
9. Shell Programming and Scripting
I have a txt file from which i am assiging a value to a variable
using the code in script1
script1.sh
export f=$(sed -n "/Freq *=/ s/.*= *//p" ${R_path}/output.txt)
echo "$f" --------> this works
in script2 ( which executes the script1)
eval ./script1.sh
if && ; then
echo... (1 Reply)
Discussion started by: shashi792
1 Replies
10. Shell Programming and Scripting
I am experimenting with some scripting as a way to learn more about it. I have a simple script that calls two other scripts. Each script echos some stuff to prove it ran and then sets a simple variable and exports it.
I cannot get one of the variables to display back in the main calling script... (2 Replies)
Discussion started by: scottrif
2 Replies
link(2) System Calls Manual link(2)
Name
link - link to a file
Syntax
link(name1, name2)
char *name1, *name2;
Description
A hard link to name1 is created; the link has the name name2. The name1 must exist.
With hard links, both name1 and name2 must be in the same file system. Unless the caller is the superuser, name1 must not be a directory.
Both the old and the new share equal access and rights to the underlying object.
Return Values
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned, and errno is set to indicate the error.
Diagnostics
The system call fails and no link is created under the following conditions:
[ENOTDIR] A component of either path prefix is not a directory.
[ENAMETOOLONG] A component of either pathname exceeded 255 characters, or the entire length of either pathname exceeded 1023 characters.
[ENOENT] A component of either path prefix does not exist.
[ENOENT] The file named by name1 does not exist.
[ENOENT] When name1 or name2 point to an empty string and the environment defined is POSIX or SYSTEM_FIVE.
[EACCES] A component of either path prefix denies search permission.
[EACCES] The requested link requires writing in a directory with a mode that denies write permission.
[EEXIST] The link named by name2 does exist.
[EPERM] The file named by name1 is a directory, and the effective user ID is not that of superuser or the environment defined is
POSIX.
[EXDEV] The link named by name2 and the file named by name1 are on different file systems.
[EROFS] The requested link requires writing in a directory on a read-only file system.
[EFAULT] One of the pathnames specified is outside the process's allocated address space.
[ELOOP] Too many symbolic links were encountered in translating one of the pathnames.
[ENOSPC] The directory in which the entry for the new link is being placed cannot be extended because there is no space left on the
file system containing the directory.
[EDQUOT] The directory in which the entry for the new link is being placed cannot be extended because the user's quota of disk blocks
on the file system containing the directory has been exhausted.
[EIO] An I/O error occurred while reading from or writing to the file system to make the directory entry.
[ESTALE] The file handle given in the argument is invalid. The file referred to by that file handle no longer exists or has been
revoked.
[ETIMEDOUT] A connect request or remote file operation failed because the connected party did not properly respond after a period of
time that is dependent on the communications protocol.
[EMLINK] The number of links to the file named by path1 would exceed {LINK_MAX}.
Environment
In the POSIX environment, linking to directories is not allowed.
See Also
symlink(2), unlink(2)
link(2)