LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   no "yeah boy!" on sunos - what gives? (https://www.linuxquestions.org/questions/linux-newbie-8/no-yeah-boy-on-sunos-what-gives-4175477366/)

casperdaghost 09-16-2013 05:56 PM

no "yeah boy!" on sunos - what gives?
 
My SunOS will not go "yeah boy" from the command line - what gives?

Code:


casper@sunny1 > echo $SHELL
/bin/bash


casper@sunny1 > uname -a | awk '{print $1}'
SunOS

casper@sunny1 > x=`uname -a | awk '{print $1}'` ; if [ "$x" == "SunOS" ]; then echo "yeah boy" ; fi
zsh: = not found


but my linux wll :
Code:

[casper@linux1 logs]$ echo $SHELL
/bin/bash

[casper@linux1 logs]$ uname -a | awk '{print $1}'
Linux


[casper@linux1]$  x=`uname -a | awk '{print $1}'` ; if [ "$x" == "Linux" ]; then echo "yeah boy\!\!\!" ; fi


yeah boy\!\!\!


druuna 09-17-2013 01:27 AM

Quote:

Originally Posted by casperdaghost (Post 5028811)
My SunOS will not go "yeah boy" from the command line - what gives?
Code:

casper@sunny1 > echo $SHELL
/bin/bash

casper@sunny1 > uname -a | awk '{print $1}'
SunOS

casper@sunny1 > x=`uname -a | awk '{print $1}'` ; if [ "$x" == "SunOS" ]; then echo "yeah boy" ; fi
zsh: = not found


You are using a zsh shell and not a bash shell.

The SHELL variable is bash/ksh specific and will not be changed when using a zsh shell.

casperdaghost 09-17-2013 07:46 AM

How do I assign the output of a command to a variable on the command line in ZSH. I have tried looking google for 'assign variable command line zsh' but have nt found anything.
is there some other way that I should phrase it for google
Is there an IRC channel dedicated to ZSH?
This was an attempt at humor, not well recieved - but i use this kind of variable assignments alot.
I think that the sysadmin enabled zsh on the sun boxes to try and add some enhancements to these legacy machines. I can't work as fast with zsh on the sun boxes and it is a pain.

druuna 09-17-2013 08:25 AM

About your problem, try this:
Code:

x=`uname -a | awk '{print $1}'` ; if [[ "$x" == "SunOS" ]]; then echo "yeah boy" ; fi
Double square brackets vs single square brackets.

About zsh vs bash: Are you forced to use zsh? You could ask the system administrator to change your login shell to bash instead. The sys admin shouldn't force you to use a specific shell unless there is a very good reason to do so.

casperdaghost 09-17-2013 09:01 AM

When you ssh to a sunos box it kicks off a script that mounts you a directory and enables ZSH.
I guess i could just get out of ZSH.
funny - when i echo the shell on the sunos box it says BASH, yet I am clearly in the ZSH shell.


The double bracket works on the SUN os boxes.
So I guess it is more of an issue with the version of bash than the shell i am using.
most of the linux boxes are 4.1 and the sun os is 3.0

linux
Code:

[casper@linux1 ]$  bash --version
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


sunos
Code:

casper@sunbox1 > bash --version
GNU bash, version 3.00.16(1)-release (i386-pc-solaris2.10)
Copyright (C) 2004 Free Software Foundation, Inc.


casperdaghost 09-17-2013 11:11 AM

i found a great way to get the ip address on a sunos box

Code:


 ping -s $HOSTNAME


druuna 09-17-2013 11:17 AM

@casperdaghost:

If you are familiar with Linux and want to know what the Solaris equivalent of a command is, then have a look here:

- A Sysadmin's Unixersal Translator (ROSETTA STONE) OR What do they call that in this world?


All times are GMT -5. The time now is 12:13 AM.