Normally, I can source ~/.bash_profile file as oracle using this command, but when I created a new file named test for another instance.
#!/bin/bash
# User specific environment and startup programs
# Oracle Settings
# User specific environment and startup programs
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
#export PATH
# Oracle Settings
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/21c/dbhome_1
export ORACLE_SID=agile
export ORA_INVENTORY=/opt/app/oraInventory
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
export DISPLAY="localhost:10.0"
export LC_ALL=C
alias sp='sqlplus / as sysdba'
alias script='cd /u02/scripts/agile'
alias software='cd /u02/software'
alias export='cd /u02/backup/export'
When I source this in a shell script and execute it, it throw me an errors of cd: too many arguments. I tried . (dot) instead of source. Same result.
$ source test
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
When I give "test" $ chmod a+x ~/test and source it, I get charset error:
$ ls -ltr test
-rwxr-xr-x. 1 oracle oinstall 724 Oct 6 14:37 test
$ souce test
GLib: Cannot convert message: Could not open converter from “UTF-8” to “AL32UTF8”
added export CHARSET=AL32UTF8 on test file and source it, I got the same error as beginning:
$ vi test
$ source test
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
even I source the main one but it's ok when su - oracle from root.
$ source .bash_profile
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
-bash: cd: too many arguments
no error when source as root
[root@ ~]# source ~oracle/test