Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the shell : command portable?

Is it recommended to use shell's : null command on supposedly portable scripts? Does it cope with csh, zsh, tcsh and whatever shell it may exist around there?

like image 613
milton Avatar asked May 30 '12 21:05

milton


People also ask

Are shell scripts portable?

In general, shell aspects that relate to syntax and built in features should be "portable" as long as the script is always executed by the same shell (and version of the shell, to some degree), even if that shell happens to be the fish shell.

How does a shell command work?

The shell is the Linux command line interpreter. It provides an interface between the user and the kernel and executes programs called commands. For example, if a user enters ls then the shell executes the ls command.

How do I make a bash script portable?

BASH or Perl is not always in the same location (PATH) such as /bin/bash or /usr/bin/perl. If you want to make sure that script is portable across different UNIX like operating systems you need to use /usr/bin/env command as shebang.

Is command line a shell?

A command-line interface (CLI) is an operating system shell that uses alphanumeric characters typed on a keyboard to provide instructions and data to the operating system, interactively.

What is shell command in terminal?

A shell command is one that is processed internally by the shell. There is no corresponding executable program. Take cd for instance. There is no /bin/cd program, say, and which cd specifies that it is a built-in command. It is part of the shell.

Can you use a terminal without a shell?

So yes, the shell and the terminal emulator are completely separate programs, and either can be used without the other.


1 Answers

Yes. It's the standard null utility. Reference: http://pubs.opengroup.org/onlinepubs/000095399/utilities/colon.html

like image 181
kojiro Avatar answered Sep 27 '22 21:09

kojiro