GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Janis-Rullis-IT/shell-scripts: Useful shell scripts

BranchesTags
Open more actions menu

Latest commit

 

History

198 Commits
198 Commits

Folders and files

NameName
Last commit message
Last commit date
learn-basics
learn-basics
 
 
md-img-gen
md-img-gen
 
 
md-ls-gen
md-ls-gen
 
 
md-nav-gen
md-nav-gen
 
 
md-tree-gen
md-tree-gen
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
TODO.md
TODO.md
 
 
album-for-share.sh
album-for-share.sh
 
 
album-for-web.sh
album-for-web.sh
 
 
albums-for-web.sh
albums-for-web.sh
 
 
code-for-web.sh
code-for-web.sh
 
 
collect-same-any-ext.sh
collect-same-any-ext.sh
 
 
collect-searched.sh
collect-searched.sh
 
 
compress-img.sh
compress-img.sh
 
 
dream.sh
dream.sh
 
 
exif-set.sh
exif-set.sh
 
 
export-all-databases-into-separate-gz-files.md
export-all-databases-into-separate-gz-files.md
 
 
export-mysql-db.sh
export-mysql-db.sh
 
 
fav.sh
fav.sh
 
 
favicon.sh
favicon.sh
 
 
fil.sh
fil.sh
 
 
gen.sh
gen.sh
 
 
gif.sh
gif.sh
 
 
gifo.sh
gifo.sh
 
 
gitd.sh
gitd.sh
 
 
gitp.sh
gitp.sh
 
 
gits.sh
gits.sh
 
 
has-git-remote-new-commits.sh
has-git-remote-new-commits.sh
 
 
img-and-code-for-web.sh
img-and-code-for-web.sh
 
 
img-to-16-9.sh
img-to-16-9.sh
 
 
import-sq-gz.md
import-sq-gz.md
 
 
is-elixir-ok.sh
is-elixir-ok.sh
 
 
mdpr.sh
mdpr.sh
 
 
merge-av.sh
merge-av.sh
 
 
png.sh
png.sh
 
 
rename-files-cp.sh
rename-files-cp.sh
 
 
res.sh
res.sh
 
 
resl.sh
resl.sh
 
 
sme.sh
sme.sh
 
 
srg.sh
srg.sh
 
 
start-video.sh
start-video.sh
 
 
video-from-jpg.sh
video-from-jpg.sh
 
 
videos-from-jpg.sh
videos-from-jpg.sh
 
 

Repository files navigation

What is a shell script?

Wiki.

Best practices

  • Best Practices for Writing Bash Scripts (kvz.io).
  • Use the Unofficial Bash Strict Mode (Unless You Looove Debugging (redsymbol.net)
  • kvz/bash3boilerplate
# Define error reporting level, file seperator, and init direcotry.
function init(){
    set -Eeuo pipefail; # set -o xtrace;
    IFS=$'\n\t'
    DIR=$PWD;
    ROOT_DIR="$(dirname "${DIR}")";
}
init

Avoid exit when child process fails

Comment out the set -Eeuo pipefail.

Error params

  • 4.3.1 The Set Builtin (gnu.org/software/bash)

Execute in terminal

  • Create a launcher.
  • Set working directory and command.
  • Check 'Open in terminal'.

Where to look for a serious working example?

  • epety/100-shell-script-examples.
  • natelandau/shell-scripts.
  • Netbeans 8.2 installer. It is a ~ 120 MB large shell script. You can download it here. It contains functions, ifs, loops and so on.

Great reads

  • man bash.
  • Advanced Bash-Scripting Guide from The Linux Documentation Project.
  • Say what? Kipibenkipod view of the world.
  • Naming_Conventions.
  • Defensive BASH Programming.

Useful tools

  • nbshell plugin for Netbeans.
  • isao/shell - various scripts and support files for noodling on the command line, esp bbedit, git, etc
  • xbot/shell - This repo hosts miscellaneous scripts I use in my daily life.
  • smilejay/shell - some of Jay's shared Shell codes. http://smilejay.com
  • hjxhjh/shell - some of my shared shell scripts
  • Crabbit/shell - My shell scripts.
  • geekcomputers/Shell - Some of the handy shell scripts I have created/acquired
  • dl - fetch remote file for convenient local reading

Good to know

  • Remember to add backslash '' for special symbols in texts. Example, echo "I don't want it." will raise error don't: command not found and the output will become I want it.. Noticed this when pushing a commit and some of the text was missing because I used `` to highlight a code.
  • Shell scripts are very strict about spaces so if[[ ... ]] won't work because after if there should be a space.

Debugging

  • http://redsymbol.net/articles/unofficial-bash-strict-mode/

  • https://www.shellcheck.net/

  • set -x for debug. More in learn-basics/debug.sh.

  • use exit to stop the script.

  • Better write outpout to file with echo -e, otherwise the output in terminal can be misleading.


Started in Jan 2018

About

Useful shell scripts

Topics

bmp-to-pngexamplesfavicon-generatorgif-generatorgitimage-manipulationimage-resizerlearnmarkdownshell-scripts

Resources

Readme
MIT license
Activity
Custom properties

Stars

12 stars

Watchers

1 watching

Forks

8 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.