Bash Equivalent of the ifmain Pattern in Python

Posted on Jul 28, 2022 in Computer Science • Tagged with Computer Science, programming, Shell, Bash, ifmain, Python, module, script, function, import, source

Things under legendu.net/outdated are outdated technologies that the author does not plan to update any more. Please look for better alternatives.

Fish Shell is preferred to Bash/Zsh. The following content is for Bash/Zsh only.

#!/usr/bin/env bash

function install_icon.usage() {
    cat << EOF
NAME
    /scripts/sys …

Continue reading

Extended Globbing in Bash

Posted on Jun 04, 2022 in Computer Science • Tagged with Computer Science, programming, bash, shell, glob, globbing, extended

Things under legendu.net/outdated are outdated technologies that the author does not plan to update any more. Please look for better alternatives.

Fish Shell is preferred to Bash/Zsh. The following content is for Bash/Zsh only.

Enable Extended Globbing

shopt -s extglob

Or you can run bash with …


Continue reading

Use fselect to Find Files

Posted on Apr 05, 2021 in Computer Science • Tagged with Computer Science, programming, fselect, Rust, find, locate

Things under legendu.net/outdated are outdated technologies that the author does not plan to update any more. Please look for better alternatives.

It is suggested that you use Python (the pathlib module) instead of the fselect command to find files.

Tips and Traps

  1. is_* columns supporting comparing with 1, true and yes, etc.

  2. where name like '%.markdown'


Continue reading

Shell Equivalent in Different Operating Systems

Posted on Sep 02, 2020 in Computer Science • Tagged with Computer Science, OS, Linux, macOS, Windows, Shell, PowerShell

Things under legendu.net/outdated are outdated technologies that the author does not plan to update any more. Please look for better alternatives.

Fish Shell is preferred to Bash/Zsh. The following content is for Bash/Zsh only.

It suggested that you use IPython shell instead of Bash/Zsh shells …


Continue reading

Programming in Shell

Posted on Oct 22, 2020 in Computer Science • Tagged with Computer Science, Shell, Bash, programming, script

Things under legendu.net/outdated are outdated technologies that the author does not plan to update any more. Please look for better alternatives.


Environment Variables in Shell

Posted on Jun 24, 2020 in Computer Science • Tagged with Computer Science, shell, bash, environment variable, export, unset

Things under legendu.net/outdated are outdated technologies that the author does not plan to update any more. Please look for better alternatives.

Fish Shell is preferred to Bash/Zsh. The following content is for Bash/Zsh only.

export

A new child process forked from a parent process does not inherit parent's variables by default. The export command marks an environment variable to be exported with any newly forked child processes and thus it allows a child process to inherit all marked variables.


Continue reading