Results 1 to 4 of 4

Thread: Ubuntu Shell Commands & Scripting

  1. #1
    Join Date
    Aug 2013
    Beans
    2

    Ubuntu Shell Commands & Scripting

    An absolute newbie question.
    Is the shell commands/scripting syntax the same between other distros of Linux especially like RH and Ubuntu ?
    Or Ubuntu's shell commands/scripting varies greatly ?

  2. #2
    Join Date
    Mar 2011
    Location
    19th Hole
    Beans
    1,239
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Ubuntu Shell Commands & Scripting

    There are variations. Not greatly but enough to give a newbie fits (been there, done that). The reality is that Linux is a hacker's OS. It's great strength is that it isn't beholden to a single imperial force. The drawback is that different distros are free to do things differently.

    Many scripts for Ubuntu won't work on Fedora. You are asking specifically about commands and syntax. Syntax is more universal, but commands are problematic. Example: Fedora doesn't use apt at all.
    Newb: How far must I jump to clear the ledge halfway down?
    Guru: It's bad to jump off cliffs. Let's look at better options.
    Newb: Stop harping about "best practices" and just tell me.


  3. #3
    Join Date
    Dec 2008
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Ubuntu Shell Commands & Scripting

    Quote Originally Posted by DuckHook View Post
    There are variations. Not greatly but enough to give a newbie fits (been there, done that). The reality is that Linux is a hacker's OS. It's great strength is that it isn't beholden to a single imperial force. The drawback is that different distros are free to do things differently.

    Many scripts for Ubuntu won't work on Fedora. You are asking specifically about commands and syntax. Syntax is more universal, but commands are problematic. Example: Fedora doesn't use apt at all.
    Huh?????

    The shell is distro agnostic. There are many shells available for use on any Linux style distro. Some of them are: Bourne Shell (sh), Bourne-Again Shell (bash), Debian Almquist Shell (dash),C Shell (csh), TENEX C Shell (tcsh), and Z Shell (zsh). There are internal commands and externally written scripts for each shell. Some of these shells are incompatible, so scripts written in one may not work in others.

    varun2]
    Is the shell commands/scripting syntax the same between other distros of Linux especially like RH and Ubuntu ?
    Or Ubuntu's shell commands/scripting varies greatly ?
    The Ubuntu default shell is dash. This is basically comparable with bash which is somewhat compatible with the original UNIX shell sh (Bourne). All of this is to say, the shell is not Ubuntu specific. As I said, the Ubuntu system uses dash. The default user shell however is bash. You can check which shell you are using with this command
    Code:
    echo $SHELL
    You can read a bit about the default shells with the built in manual like this
    Code:
    man <shell>
    ...where <shell> is either dash, bash or sh. The man page for sh is really dash, but you can find plenty of information about the original Bourne Shell on the Internet. You would have to install the other shells to read their man pages. Of course, you can search the Internet for more information on all of the shells mentioned above.
    Last edited by capscrew; August 10th, 2013 at 08:34 AM.

  4. #4
    Join Date
    Mar 2008
    Beans
    1,219

    Re: Ubuntu Shell Commands & Scripting

    Quote Originally Posted by capscrew View Post
    The shell is distro agnostic.
    Shells are distro agnostic but configuration files aren't. Pretty much any complex script written for a specific distro needs to be rewritten to a certain degree if you move to a different distro.

    Bash syntax is the same everywhere (though, depending on bash version, certain constructs may or may not work) but available packages vary. Moreover, even what looks like the same command may not be exactly the same. For example, nc can be GNU netcat, netcat-bsd or ncat.

    So which and man commands are always your friends when you deal with an unfamiliar distro.
    Last edited by prodigy_; August 10th, 2013 at 09:17 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •