Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254
Rep:
export is not working on command prompt
Hi,
The command export is working inside a shell script, but when I type it at the command prompt / terminal it doesn't work. "export: The command not found" error is displayed instead.
I tried this:
cat test.sh
Code:
abc=123
export abc
echo "Exit status of export abc: $?"
Code:
# bash test.sh
Exit status of export abc: 0
But when I type it at the command prompt:
Code:
# export abc=123
I get the "the command not found" error.
Code:
man export
is also working fine.
I tried it before on my RHEL system and it was working. I have checked
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254
Original Poster
Rep:
Quote:
Originally Posted by catkin
What is the output of type export ?
I will post it after 9 hours. I am at office right now. The problem I observed is on my personal computer at my room.
But thanks for the useful command: type
I have checked this command on the system I am using righ tnow:
Code:
-bash-2.05b# type export
export is a shell builtin
-bash-2.05b# type ls
ls is aliased to `ls --color=tty'
-bash-2.05b# type dir
dir is hashed (/usr/bin/dir)
-bash-2.05b# type echo
echo is a shell builtin
-bash-2.05b# type :
: is a shell builtin
-bash-2.05b#
What does this output, as given above and below, mean?
Code:
-bash-2.05b# type dir
dir is hashed (/usr/bin/dir)
What does this output, as given above and below, mean?
Code:
-bash-2.05b# type dir
dir is hashed (/usr/bin/dir)
When a command is not a bash alias, builtin or function, bash searches the directories listed in the value of the $PATH variable for a file that matches the command's name. This search is relatively "expensive" so, for better performance, bash keeps a table of commands that it has already looked up, known as a hash table, which it consults before scanning all the $PATH directories. There's more about it here if you scroll down to hash.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.