I have downloaded pig but it is not working - apache-pig

I have installed Pig. But when I am running command to check pig version. It is saying invalid option. I have edited bashrc file.
After doing source .bashrc I am getting following error:
hduser#ubuntu:~$ source .bashrc
bash: export: '=': not a valid identifier
bash: export: '/usr/local/pig': not a valid identifier
bash: export: '=': not a valid identifier
bash: export: 'PATH:/usr/local/pig/bin': not a valid identifier
bash: export: '=': not a valid identifier
bash: export: '/usr/local/hadoop/conf': not a valid identifier

The export statements added to the .bashrc file should not contain whitespaces around =
Edit ~/.bashrc, since the $PATH variable is unset, use absolute paths for the executables.
/usr/bin/vi ~/.bashrc
Add these lines for Pig (taken from the comments) to the bashrc file,
export PIG_HOME=/usr/local/pig-0.15.0
export PATH=$PIG_HOME/bin:$PATH

Related

Can't run nvm of Fish shell on Mac [duplicate]

This question already has an answer here:
How to manage my node version using Fish Shell
(1 answer)
Closed 13 days ago.
I have installed Fish shell via Brew.
According to the instructions given on the terminal while installing Fish, I added:
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
to
~/.config/fish/config.fish
and to
~/.zprofile
On normal terminal I can run nvm however on fish it says fish: Unknown command: nvm
If I do source ~/.config/fish/config.fish I get:
/opt/homebrew/Cellar/nvm/0.39.3/libexec/nvm.sh (line 386): Unexpected ')' found, expecting '}'
*[!/]*/)
^
from sourcing file /opt/homebrew/Cellar/nvm/0.39.3/libexec/nvm.sh
called on line 3 of file /opt/homebrew/opt/nvm/nvm.sh
from sourcing file /opt/homebrew/opt/nvm/nvm.sh
called on line 6 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
.: Error while reading file '/opt/homebrew/Cellar/nvm/0.39.3/libexec/nvm.sh'
/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm (line 5): Missing end to balance this if statement
if ! command -v nvm &> /dev/null; then
^^
from sourcing file /opt/homebrew/opt/nvm/etc/bash_completion.d/nvm
called on line 7 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
.: Error while reading file '/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm'
What can I do to run nvm on Fish?
What the error message tells you is that nvm is not a fish script.
nvm is written as a posix-compatible shell script and fish is intentionally not posix-compatible.
This bit here:
\. "/opt/homebrew/opt/nvm/nvm.sh"
Tells the shell to "source" nvm.sh, meaning to run it in the current shell. That won't work because fish isn't a posix shell.
You'll have to use either another version manager like nvm.fish or use a posix-to-fish shim like bass and do something like its nvm instructions:
bass source ~/.nvm/nvm.sh --no-use ';' nvm use iojs

zsh: command not found: duarouter to create a rou.xml file

I'm using sumo in macOS. I'm trying to create a duarouter by calling the following command after creating a random trips for a given network:
duarouter -n ~/SUMOTutorials/sumotest.net.xml --route-files ~/SUMOTutorials/sumotest.trips.xml -o ~/SUMOTutorials/sumotest.rou.xml --ignore-errors
However I just get the error:
zsh: command not found: duarouter
I see in sumo directory there is duarouter of kind Unix executable file in sumo/bin and sumo/tests and in I run the above command when I'm in each of those directory but I just get an error.
I found the answer. Because the type is Unix executable file, we have to write the following in the directory where it is:
./duarouter -n ~/SUMOTutorials/sumotest.net.xml --route-files ~/SUMOTutorials/sumotest.trips.xml -o ~/SUMOTutorials/sumotest.rou.xml --ignore-errors.

(eval):1 parse error near 'then'

I am getting an error of (eval):1 parse error near 'then' when I used zsh's command 'source .zshrc'.
~ source .zshrc
(eval):1: parse error near `then'
this is my .zshrc file:
export ZSH=/Users/chourongqishi/.oh-my-zsh
export PATH=${PATH}:/usr/local/mysql/bin
export PATH=${PATH}:/usr/local/bin
export JAVA_HOME=/usr/libexec/java_home
export
PATH=${PATH}:${JAVA_HOME}:${ANDROID_SDK_ROOT}:${ANDROID_SDK_ROOT}
/platform-tools:${ANDROID_SDK_ROOT}/tools:${JAVA_HOME}:${JAVA_HOME}/bin
export PATH=${PATH}:/Users/chourongqishi/Library/Android/sdk/platform-
tools
export PATH=${PATH}:/Users/chourongqishi/Library/Android/sdk/tools
plugins=(git)
source $ZSH/oh-my-zsh.sh
source ~/.bash_profile
alias cls='clear'
alias -s html=subl
alias -s txt=subl
alias -s java=subl
alias -s xml=subl
The error comes from the source directive which you use. The source directive will execute the files they are provided, within the context of the current script.
You use source ~/.bash_profile. This file is a bash script, you are trying to execute it in zsh.
This is where your problem comes from: ensure you do not import files made for other shell programs.

bash sqlplus command not found

I am trying to install sqlplus on my mac following the tutorial here: https://tomeuwork.wordpress.com/2014/05/12/how-to-install-oracle-sqlplus-and-oracle-client-in-mac-os/comment-page-1/#comment-6
I have downloaded the two packages (basic and sqlplus) and created all the directories as it says, I moved the necessary files inside the directories.
I created and copied the tnsnames.ora file with the contents:
MYDB=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=*********)
(PORT=1521)
)
(CONNECT_DATA=
(SERVER=dedicated)
(SID=MYDB-SID)
) )
And i created the .bash_profile as it says in the tutorial.
But what im stuck on is making the sqlplus run.
typing in sqlplus returns command not found.
in the tutorial it says i should use $ sqlplus username/password#database
where do i get the username and database name from?, I haven't created one yet.
Thanks in advance.
According to your article, you should do the following:
$ vi ~/.bash_profile
Add the following line to the end of the file.
alias sqlplus=’rlwrap sqlplus’
Now reload the .bash_profile:
$ source ~/.bash_profile
Looks like you missed these steps.
You can try to execute:
$rlwrap sqlplus
According to the comments below you do not have sqlplus in the $PATH.
The value of $PATH looks wrong to me: duplicates, quotes.
Option 1
Execute:
export PATH=/Applications/‌​or‌​acle/product/instantclient_64/11.2.0.4.0/bin:/usr/local/bin:/usr/bin:/bin:/us‌​r/s‌​bin:/sbin
Then execute in the same console:
$ sqlplus (or $ rlwrap sqlplus)
It will set value only for the current shell. The main idea is to have full path to the sqlplus binary in the $PATH.
Option 2
Modify ~/.bash_profile.
To save as a permanent environment variable edit ~/.bash_profile. There are some details about setting PATH in the source article.
Top down troubleshooting approach
Look for binary - use type
[bbrandt] ~/ $ type sqlplus
sqlplus is aliased to `rlwrap sqlplus'
Where is my binary.. hidden behind an alias, let's unalias
[bbrandt] ~/ $ unalias sqlplus
[bbrandt] ~/ $ type sqlplus
sqlplus is /u01/app/oracle/product/11.2.0/xe/bin/sqlplus
Found it! What happens if I modify my binary search-path?
[bbrandt] ~/ $ echo $PATH
/u01/app/oracle/product/11.2.0/xe/bin:/home/bbrandt/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
[bbrandt] ~/ $ export PATH=/home/bbrandt/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
Now, where is my binary?
[bbrandt] ~/ $ type sqlplus
bash: type: sqlplus: not found
[bbrandt] ~/ $
This is where you are... look in your $PATH variable

Cannot locate pig-core-h1.jar. do 'ant jar', and try again

I have installed pig in my system by using following steps -
first i have downloaded pig-0.14.0.tar.gz
then i have extracted
tar xvzf /home/impadmin/Downloads/pig-0.14.0.tar.gz
sudo mv pig-0.14.0 /usr/local/pig
sudo chown -R hduser:hadoop pig
nano ~/.bashrc
then added the following lines in bashrc file
# PIG binary paths
export PIG_INSTALL="/usr/local/pig"
export PATH="${PATH}:${PIG_INSTALL}/bin"
touch ~/.pigbootup
nano /usr/local/pig/conf/pig.properties
then added the following code in pig.properties
pig.logfile=/home/hduser/hadoop/pig/logs/
after insatllation when i am executing pig version command
then its giving me error -
Cannot locate pig-core-h1.jar. do 'ant jar', and try again
there is a jar file named pig-0.14.0-core-h1.jar so i copied the same file and renamed it as pig-core-h1.jar but still its giving me the same error .
have i done anything wrong during installation?
~/.bashrc should look like this
# PIG binary paths
export PIG_INSTALL="/usr/local/pig"
export PATH="$PATH:$PIG_INSTALL/bin"
No need for the curly brackets
additionally you need to (this or reboot the machine):
$source ~/.bashrc