简体   繁体   中英

Unable to source profile: export: Command not found

I encounter a problem when trying to source the /etc/profile in Linux. I run the following command in Linux command line as root:

# vi /etc/profile

Add two lines to profile:

export JAVA_HOME=/usr/java/jdk1.7.0_25/bin/java
export PATH=$PATH:/usr/java/jdk1.7.0_25/bin

save profile.

# source /etc/profile

Error:
PATH=/bin:/usr/bin:/usr/dev_infra/platform/bin:/usr/dev_infra/generic/bin:/usr/local/bin: Command not found.
export: Command not found.
Badly placed ()'s.

I don't know why this "command not found" error occurs. The existing workarounds seem not helpful to my issue.

Thanks

The bad news: /etc/profile is compatible with Bourne compatible shells only (sh/bash/ash etc.)

The good news: you could write your own 'profile' file and source it into your script:

cat /somewhere/your-sourced-file

setenv JAVA_HOME '/usr/java/jdk1.7.0_25/bin/java'
setenv PATH $PATH':/usr/java/jdk1.7.0_25/bin'

and then use source /somewhere/your-sourced-file to include it into your csh script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM