PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Sep 19, 2019 12:41 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Aug 26, 2010 6:47 pm 
Offline
Forum Contributor

Joined: Fri Feb 05, 2010 8:15 pm
Posts: 101
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

Syntax: [ Download ] [ Hide ]
abc=123
export abc
echo "Exit status of export abc: $?"


Syntax: [ Download ] [ Hide ]
# bash test.sh
Exit status of export abc: 0


But when I type it at the command prompt:

Syntax: [ Download ] [ Hide ]
# export abc=123


I get the "the command not found" error.

Syntax: [ Download ] [ Hide ]
man export
is also working fine.

I tried it before on my RHEL system and it was working. I have checked the $PATH variable also it is okay. What could be the problem?


Top
 Profile  
 
PostPosted: Sat Aug 28, 2010 1:02 pm 
Offline
Forum Contributor

Joined: Fri Feb 05, 2010 8:15 pm
Posts: 101
The problem is solved now. So, I want to post here the solution I found:

I have just found that my shell got changed to csh and it was creating the problem.

Syntax: [ Download ] [ Hide ]
[root@localhost ~]# grep ^"$USER" /etc/passwd
root:x:0:0:root:/root:/bin/csh


I changed it to bash and the problem was resolved!

Syntax: [ Download ] [ Hide ]
[root@localhost ~]# type export
export is a shell builtin



I experimented with these commands:

Syntax: [ Download ] [ Hide ]
[root@localhost ~]# csh
[root@localhost ~]# type export
type: Command not found.
[root@localhost ~]# bash
[root@localhost ~]# type export
export is a shell builtin
[root@localhost ~]# grep ^"$USER" /etc/passwd
root:x:0:0:root:/root:/bin/bash
 



The problem has taught me some troubleshooting techniques

Syntax: [ Download ] [ Hide ]
type <command> <enter>


and first where to check when a command is not working, i.e. the log-in shell.

Syntax: [ Download ] [ Hide ]
grep ^"$USER" /etc/passwd


or

Syntax: [ Download ] [ Hide ]
echo $SHELL


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group