This programming language may be used to instruct a computer to perform a task.
Execution method: | Interpreted |
---|---|
Lang tag(s): | bash |
See Also: |
|
If you know UNIX Shell, please write code for some of the tasks not implemented in UNIX Shell.
Implementation[edit]
There are many UNIX Shells and most of them can be categorized into two families. For purposes of the Rosetta Code, all examples are in Bourne-compatible syntax. The other family of shells, with a markedly different syntax, are csh (C Shell) and its tcsh (Tenex C Shell) "clone." Common Bourne compatible shells include the original Bourne Shell (/bin/sh on most versions of UNIX), the GNU Bourne Again SHell (bash --- which is linked to /bin/sh on many distributions of Linux, making it their default shell), the Korn Shell (ksh), the Public Domain Korn SHell (pdksh), the Almquist SHell (ash) and the Debian Almquist SHell (dash) and the Z SHell (zsh).
Main article: UNIX Shell Implementations
Language[edit]
While UNIX Shells vary in the programming languages they support, such languages carry a minimum set of features. Each language allows the programmer to execute system commands as though he were typing the commands himself, and each language allows for a header line which specifies which shell implementation is used to interpret the script.
This one tells the operating system to use the Bourne Shell:
#!/bin/sh
This line tells the operating system to use the Bourne Again SHell:
#!/bin/bash
And this one tells the operating system to use the Korn Shell:
#!/bin/ksh
Each header line consists of a hash, a bang, and the path to the interpreter binary.
Subcategories
This category has the following 5 subcategories, out of 5 total.
Pages in category "UNIX Shell"
The following 297 pages are in this category, out of 297 total.
2
A
- A* search algorithm
- A+B
- ABC problem
- Accumulator factory
- Ackermann function
- Active Directory/Search for a user
- Align columns
- Anagrams
- Anagrams/Deranged anagrams
- Anonymous recursion
- Append a record to the end of a text file
- Apply a callback to an array
- Arithmetic-geometric mean
- Arithmetic/Complex
- Arithmetic/Integer
- Array concatenation
- Array length
- Arrays
- Assertions
- Associative array/Creation
- Associative array/Iteration
- Averages/Arithmetic mean
- Averages/Mode
B
C
- Caesar cipher
- Calendar
- Calendar - for "REAL" programmers
- Call a function
- Case-sensitivity of identifiers
- Check input device is a terminal
- Check output device is a terminal
- Check that file exists
- Chinese zodiac
- Classes
- Collections
- Colour bars/Display
- Comma quibbling
- Command-line arguments
- Comments
- Compound data type
- Conditional structures
- Copy a string
- Count in octal
- Count occurrences of a substring
- Count the coins
- Create a file
- Create a file on magnetic tape
- Create an HTML table
- CSV data manipulation
- CSV to HTML translation
D
- Date format
- Date manipulation
- Day of the week
- Days between dates
- Deal cards for FreeCell
- Define a primitive data type
- Delete a file
- Determine if a string is numeric
- Determine if only one instance is running
- Digital root
- Dinesman's multiple-dwelling problem
- Dutch national flag problem
- Dynamic variable names
E
F
G
H
I
J
L
- Last Friday of each month
- Leap year
- Least common multiple
- Linear congruential generator
- Linux CPU utilization
- Literals/Integer
- Literals/String
- Long multiplication
- Long year
- Look-and-say sequence
- Loop over multiple arrays simultaneously
- Loops/Break
- Loops/Continue
- Loops/Do-while
- Loops/Downward for
- Loops/For
- Loops/For with a specified step
- Loops/Foreach
- Loops/Infinite
- Loops/N plus one half
- Loops/Nested
- Loops/While
- Luhn test of credit card numbers
M
P
R
- Random number generator (device)
- Random number generator (included)
- Range expansion
- Range extraction
- Rate counter
- Read a configuration file
- Read a file line by line
- Read a specific line from a file
- Read entire file
- Real constants and functions
- Regular expressions
- Remove lines from a file
- Rename a file
- Rep-string
- Repeat a string
- Respond to an unknown method call
- Return multiple values
- Reverse a string
- Reverse words in a string
- Rock-paper-scissors
- Roman numerals/Decode
- Roman numerals/Encode
- Rosetta Code/Run examples
- Rot-13
- Runtime evaluation
- Runtime evaluation/In an environment
S
- Scope/Function names and labels
- Search a list
- Secure temporary file
- Self-describing numbers
- SHA-1
- Shell one-liner
- Short-circuit evaluation
- Show the epoch
- Sierpinski carpet
- Sieve of Eratosthenes
- Simple database
- Sleep
- Sockets
- Sort an array of composite structures
- Sort an integer array
- Sorting algorithms/Sleep sort
- Soundex
- Special characters
- Special variables
- Speech synthesis
- Stable marriage problem
- Stream merge
- String case
- String comparison
- String concatenation
- String interpolation (included)
- String length
- Strip a set of characters from a string
- Strip comments from a string
- Subleq
- Substring
- Substring/Top and tail
- Sum and product of an array
- Symmetric difference
- System time
T
- Take notes on the command line
- Temperature conversion
- Terminal control/Clear the screen
- Terminal control/Coloured text
- Terminal control/Cursor movement
- Terminal control/Cursor positioning
- Terminal control/Dimensions
- Terminal control/Hiding the cursor
- Terminal control/Inverse video
- Terminal control/Preserve screen
- Terminal control/Ringing the terminal bell
- Terminal control/Unicode output
- Test a function
- Text between
- The Name Game
- The Twelve Days of Christmas
- Time a function
- Tokenize a string
- Topic variable
- Topological sort
- Towers of Hanoi
- Tree traversal
- Truncate a file