📜

Shell Scripting

39 cards · 🇺🇸 English

Bash scripting syntax: variables, loops, conditionals, and functions.

Study all 39 cards for free

Flashcards, quizzes, pixel-art games and a daily review that remembers for you.

Study this deck free

Try the first 10 cards

1 / 10
Question

Shell script

Knew itLearning

Tap the card for the answer · swipe right if you knew it, left if not

Already have an account? Sign in

Cards

  1. 1Shell script
    A computer program designed to be run by a Unix shell, a command-line interpreter
  2. 2Shell script dialects considered to be
    Command languages
  3. 3Wrapper script
    A script that sets up the environment, runs a program, and does any necessary cleanup or logging
  4. 4Shebang
    A special comment starting with #! that tells the system which interpreter to use to execute the script
  5. 5Where must the shebang be located?
    It must be the first line of the file and start with #!
  6. 6Most common shebang for bash scripts
    #!/bin/bash or #!/bin/sh for POSIX-compliant shells
  7. 7How do comments work in shell scripts?
    They begin with the hash symbol (#) and continue until the end of the line
  8. 8What shells are guaranteed on Unix-like systems?
    At least one POSIX shell, typically either bash or zsh in compatibility mode
  9. 9POSIX
    Portable Operating System Interface - a standard for Unix-like operating systems
  10. 10Bash
    GNU Bash (Bourne Again Shell) - the most common Unix shell for interactive use and scripting
  11. 11Dash
    Debian Almquist shell - a minimal POSIX-compliant shell, often used as /bin/sh for speed
  12. 12Zsh
    Z shell - a modern shell with many features, compatible with bash when run in compatibility mode
  13. 13Bourne shell
    The original Unix shell (sh), created by Stephen Bourne, though no longer in common use
  14. 14KornShell
    A Unix shell (ksh) that improved on the Bourne shell, mostly replaced by zsh
  15. 15Bashisms
    Bash-specific features and extensions not found in POSIX, which may reduce compatibility with other shells
  16. 16Main advantage of shell scripting
    Commands and syntax are exactly the same as those entered directly at the command-line
  17. 17Major disadvantage of shell scripting
    Slow execution speed and the need to launch a new process for almost every command, plus proneness to costly typing errors
  18. 18What did Larry Wall say about shell portability?
    It's easier to port a shell than a shell script - highlighting compatibility problems between platforms
  19. 19Famous dangerous shell script error
    rm -rf * / (with extra space) deletes everything from the root directory instead of just subdirectories
  20. 20'for' loop
    Iterates over a list of items, executing commands for each item in the list
  21. 21'if'
    Provides conditional execution based on test results
  22. 22What file extension is common for shell scripts?
    .sh, though most shell scripts have no filename extension at all
  23. 23Ls command
    Lists files and directories in the current or specified directory
  24. 24Clear command
    Clears the terminal screen of all text
  25. 25Printf used for in shell scripts
    Formatted output printing, more portable than echo across different shells
  26. 26Sed
    Stream editor - a Unix tool for parsing and transforming text, often used in shell scripts
  27. 27Awk
    A text processing language and tool for pattern scanning and processing, commonly used with shell scripts
  28. 28Grep
    A command-line utility for searching text using patterns (regular expressions)
  29. 29Pipeline in shell scripting
    Connecting commands where the output of one becomes the input of another using the | operator
  30. 30Make
    A build automation tool that replaced simple shell script compilation since the 1980s

And 9 more cards. Study the whole deck free

Articles about this deck

More Programming decks

See all
Study all 39 cards free