Minutes 2026-10-29: Difference between revisions
(create page with the notes) |
m (fix formatting... oopsie) |
||
| Line 2: | Line 2: | ||
Scripting? |
Scripting? |
||
Executables are not binary |
|||
Executables are not binary |
|||
Files start with #! (Shebang) |
|||
Defines what binary to run the file in |
|||
Files start with #! (Shebang) |
|||
Usually /bin/bash |
|||
Can do it with other programming langues or anything! |
|||
Defines what binary to run the file in |
|||
Good for automation/customization |
|||
Usually /bin/bash |
|||
Can do it with other programming langues or anything! |
|||
Good for automation/customization |
|||
What languages? |
What languages? |
||
Any |
|||
Any |
|||
Can even do auto-compiled C with GCC |
|||
Usually POSIX shell like bash |
|||
Can even do auto-compiled C with GCC |
|||
env/bin/bash is more 'proper' |
|||
Python |
|||
Usually POSIX shell like bash |
|||
Some scripts on your system |
|||
Pacman |
|||
env/bin/bash is more 'proper' |
|||
Other shells |
|||
fish, csh, zsh |
|||
Python |
|||
Shell (server) uses ZSH |
|||
Other shells come with their own languages since that's just what they are |
|||
Some scripts on your system |
|||
All high-level |
|||
All terminal commands are shell commands |
|||
Pacman |
|||
Pipes (part of bash language) |
|||
Bash is part of POSIX standard so it's common on Linux/UNIX |
|||
Other shells |
|||
Bash language |
|||
It's old |
|||
fish, csh, zsh |
|||
Bounre shell |
|||
Dates back to 60s |
|||
Shell (server) uses ZSH |
|||
Other shells come with their own languages since that's just what they are |
|||
All high-level |
|||
All terminal commands are shell commands |
|||
Pipes (part of bash language) |
|||
Bash is part of POSIX standard so it's common on Linux/UNIX |
|||
Bash language |
|||
It's old |
|||
Bounre shell |
|||
Dates back to 60s |
|||
Use cases |
Use cases |
||
Run scripts on keybind |
|||
Run scripts on keybind |
|||
You can bind any executable to a keybind |
|||
Shortcuts (open apps) as well |
|||
You can bind any executable to a keybind |
|||
See the weather |
|||
Interactive menus |
|||
Shortcuts (open apps) as well |
|||
dmenu |
|||
Take in a list of things and sort through them |
|||
See the weather |
|||
Useful for menus |
|||
Repetitive tasks |
|||
Interactive menus |
|||
Examples: |
|||
Transferring pictures off a camera |
|||
dmenu |
|||
Freya found a Youtube channel with a lot of cool shell scripts |
|||
Videos edited with scripts |
|||
Take in a list of things and sort through them |
|||
Automated FFmpeg scripts |
|||
Stringing together data |
|||
Useful for menus |
|||
Screenshots |
|||
Can use slurp/grim on Wayland |
|||
Repetitive tasks |
|||
Usually scripted |
|||
Can make it dynamic |
|||
Examples: |
|||
Process data |
|||
Transferring pictures off a camera |
|||
Freya found a Youtube channel with a lot of cool shell scripts |
|||
Videos edited with scripts |
|||
Automated FFmpeg scripts |
|||
Stringing together data |
|||
Screenshots |
|||
Can use slurp/grim on Wayland |
|||
Usually scripted |
|||
Can make it dynamic |
|||
Process data |
|||
Basics of bash |
Basics of bash |
||
No built in functions |
|||
No built in functions |
|||
Just call commandline applications |
|||
Built on commands like cs, ls |
|||
Just call commandline applications |
|||
Familiar if you use CLI a lot |
|||
Bash environment is entirely dependent on what you have installed |
|||
Built on commands like cs, ls |
|||
JSON parsing (bad) and dependent on system packages |
|||
Lots of cool programs to do nice things |
|||
Familiar if you use CLI a lot |
|||
Environment variables |
|||
Just a bash variable |
|||
Bash environment is entirely dependent on what you have installed |
|||
East to access in shell environments |
|||
They can be complicated on other languages |
|||
JSON parsing (bad) and dependent on system packages |
|||
Awful syntax but decently powerful |
|||
Good for stringing commands together with pipes |
|||
Lots of cool programs to do nice things |
|||
Variables |
|||
Assign a string to a name |
|||
Environment variables |
|||
Easy to access with $ |
|||
Echo |
|||
Just a bash variable |
|||
Print statements |
|||
Read lines from standard input |
|||
East to access in shell environments |
|||
Grab user data |
|||
If statements must end in fi |
|||
They can be complicated on other languages |
|||
Some bash statements are ended with themselves backwards |
|||
Really weird getting arguments |
|||
Awful syntax but decently powerful |
|||
Square brackets with required spaces |
|||
Brackets are technically a command... |
|||
Good for stringing commands together with pipes |
|||
Typical programming languages things (Loops, brackets, else-if) |
|||
Bash is a mess.... |
|||
Variables |
|||
Is this how professors feel teaching Java 8 to students? |
|||
Or C89? |
|||
Assign a string to a name |
|||
Exit codes are like return statements to exit or give errors |
|||
Easy to access with $ |
|||
Echo |
|||
Print statements |
|||
Read lines from standard input |
|||
Grab user data |
|||
If statements must end in fi |
|||
Some bash statements are ended with themselves backwards |
|||
Really weird getting arguments |
|||
Square brackets with required spaces |
|||
Brackets are technically a command... |
|||
Typical programming languages things (Loops, brackets, else-if) |
|||
Bash is a mess.... |
|||
Is this how professors feel teaching Java 8 to students? |
|||
Or C89? |
|||
Exit codes are like return statements to exit or give errors |
|||
Built-in things |
Built-in things |
||
$n gets number 0 to 9 |
|||
$n gets number 0 to 9 |
|||
See if program failed unless it's being weird |
|||
$? gets error codes |
|||
$! gets PID of background commnand |
|||
See if program failed unless it's being weird |
|||
Lets you run things asynchronously |
|||
$@ gets arguments as arrays |
|||
$! gets PID of background commnand |
|||
Lets you run things asynchronously |
|||
Environment values |
Environment values |
||
Home directory |
|||
Home directory |
|||
Current username |
|||
PATH variable |
|||
Current username |
|||
XDG variables |
|||
.config |
|||
PATH variable |
|||
cache home |
|||
local home |
|||
XDG variables |
|||
Better for portability |
|||
.config |
|||
cache home |
|||
local home |
|||
Don't hardcode paths, use variables instead |
|||
Better for portability |
|||
Things to remember |
Things to remember |
||
Commands make life easy |
|||
Commands make life easy |
|||
Learn to use awk, sed, and jq |
|||
Text replacement |
|||
Learn to use awk, sed, and jq |
|||
JSON parsing |
|||
Curl for internet stuff |
|||
Text replacement |
|||
Or wget |
|||
There's functions |
|||
JSON parsing |
|||
Make things easy for yourself |
|||
But nobody uses them except for fork bombs |
|||
Curl for internet stuff |
|||
Or wget |
|||
There's functions |
|||
Make things easy for yourself |
|||
But nobody uses them except for fork bombs |
|||
Demo time! |
Demo time! |
||
Window manager mishaps... |
|||
Window manager mishaps... |
|||
Example scripts |
|||
National weather service provides prerendered radar GIFs |
|||
Example scripts |
|||
Just a URL |
|||
Always updated |
|||
National weather service provides prerendered radar GIFs |
|||
Can grab them with a script |
|||
Downloads the gif to /tmp and plays it |
|||
Just a URL |
|||
Make widgets? |
|||
Uses just curl and mpv |
|||
Always updated |
|||
QR generator script |
|||
Save text |
|||
Can grab them with a script |
|||
qrencode then print as image |
|||
Scan QR from screen or camera |
|||
Downloads the gif to /tmp and plays it |
|||
All very simple, just stringing shell commands together |
|||
Aurora script |
|||
Make widgets? |
|||
Shows it on a map in a window |
|||
Free API from NOAA |
|||
Uses just curl and mpv |
|||
Graph of probability |
|||
Script to add todo list item |
|||
QR generator script |
|||
Doesn't work... |
|||
Brightness control |
|||
Save text |
|||
Drivers for brightnessctl may be broken |
|||
Complaining about chromeOS? |
|||
qrencode then print as image |
|||
Converts value to percentage |
|||
Hardcoded path..... |
|||
Scan QR from screen or camera |
|||
Waybar extension |
|||
Outputs todo status to the bar |
|||
All very simple, just stringing shell commands together |
|||
Just a loop to show items |
|||
Aurora script |
|||
Shows it on a map in a window |
|||
Free API from NOAA |
|||
Graph of probability |
|||
Script to add todo list item |
|||
Doesn't work... |
|||
Brightness control |
|||
Drivers for brightnessctl may be broken |
|||
Complaining about chromeOS? |
|||
Converts value to percentage |
|||
Hardcoded path..... |
|||
Waybar extension |
|||
Outputs todo status to the bar |
|||
Just a loop to show items |
|||
Cronjobs |
Cronjobs |
||
Do custom things on schedules |
|||
Do custom things on schedules |
|||
Weather alerts |
|||
Weather alerts |
|||
Scripting Magnum Opus |
Scripting Magnum Opus |
||
Grabs days of weathers |
|||
Grabs days of weathers |
|||
Pulled from weather services |
|||
Only took 2 hours |
|||
Pulled from weather services |
|||
Very easy |
|||
It's free! |
|||
Only took 2 hours |
|||
Don't pay for weather APIs |
|||
National weather service is free and good |
|||
Very easy |
|||
Raw model data is also free |
|||
Even the notes they're taking |
|||
It's free! |
|||
Forecast function takes in URLs and outputs JSON |
|||
Freya also wrote scripts for brightness and volume |
|||
Don't pay for weather APIs |
|||
Wants to bind it to a shortcut |
|||
National weather service is free and good |
|||
Raw model data is also free |
|||
Even the notes they're taking |
|||
Forecast function takes in URLs and outputs JSON |
|||
Freya also wrote scripts for brightness and volume |
|||
Wants to bind it to a shortcut |
|||
Inspiration |
Inspiration |
||
Bread on Penguins |
|||
Bread on Penguins |
|||
Videos showing scripts |
|||
Automated with ffmpeg |
|||
Videos showing scripts |
|||
Cool things |
|||
Automated with ffmpeg |
|||
Cool things |
|||
One more thing |
One more thing |
||
LUG lan party 3 on Sunday |
|||
LUG lan party 3 on Sunday |
|||
End |
End |
||
Latest revision as of 23:54, 29 October 2026
BASH scripting by Freya!
Scripting?
Executables are not binary
Files start with #! (Shebang)
Defines what binary to run the file in
Usually /bin/bash
Can do it with other programming langues or anything!
Good for automation/customization
What languages?
Any
Can even do auto-compiled C with GCC
Usually POSIX shell like bash
env/bin/bash is more 'proper'
Python
Some scripts on your system
Pacman
Other shells
fish, csh, zsh
Shell (server) uses ZSH
Other shells come with their own languages since that's just what they are
All high-level
All terminal commands are shell commands
Pipes (part of bash language)
Bash is part of POSIX standard so it's common on Linux/UNIX
Bash language
It's old
Bounre shell
Dates back to 60s
Use cases
Run scripts on keybind
You can bind any executable to a keybind
Shortcuts (open apps) as well
See the weather
Interactive menus
dmenu
Take in a list of things and sort through them
Useful for menus
Repetitive tasks
Examples:
Transferring pictures off a camera
Freya found a Youtube channel with a lot of cool shell scripts
Videos edited with scripts
Automated FFmpeg scripts
Stringing together data
Screenshots
Can use slurp/grim on Wayland
Usually scripted
Can make it dynamic
Process data
Basics of bash
No built in functions
Just call commandline applications
Built on commands like cs, ls
Familiar if you use CLI a lot
Bash environment is entirely dependent on what you have installed
JSON parsing (bad) and dependent on system packages
Lots of cool programs to do nice things
Environment variables
Just a bash variable
East to access in shell environments
They can be complicated on other languages
Awful syntax but decently powerful
Good for stringing commands together with pipes
Variables
Assign a string to a name
Easy to access with $
Echo
Print statements
Read lines from standard input
Grab user data
If statements must end in fi
Some bash statements are ended with themselves backwards
Really weird getting arguments
Square brackets with required spaces
Brackets are technically a command...
Typical programming languages things (Loops, brackets, else-if)
Bash is a mess....
Is this how professors feel teaching Java 8 to students?
Or C89?
Exit codes are like return statements to exit or give errors
Built-in things
$n gets number 0 to 9
$? gets error codes
See if program failed unless it's being weird
$@ gets arguments as arrays
$! gets PID of background commnand
Lets you run things asynchronously
Environment values
Home directory
Current username
PATH variable
XDG variables
.config
cache home
local home
Don't hardcode paths, use variables instead
Better for portability
Things to remember
Commands make life easy
Learn to use awk, sed, and jq
Text replacement
JSON parsing
Curl for internet stuff
Or wget
There's functions
Make things easy for yourself
But nobody uses them except for fork bombs
Demo time!
Window manager mishaps...
Example scripts
National weather service provides prerendered radar GIFs
Just a URL
Always updated
Can grab them with a script
Downloads the gif to /tmp and plays it
Make widgets?
Uses just curl and mpv
QR generator script
Save text
qrencode then print as image
Scan QR from screen or camera
All very simple, just stringing shell commands together
Aurora script
Shows it on a map in a window
Free API from NOAA
Graph of probability
Script to add todo list item
Doesn't work...
Brightness control
Drivers for brightnessctl may be broken
Complaining about chromeOS?
Converts value to percentage
Hardcoded path.....
Waybar extension
Outputs todo status to the bar
Just a loop to show items
Cronjobs
Do custom things on schedules
Weather alerts
Scripting Magnum Opus
Grabs days of weathers
Pulled from weather services
Only took 2 hours
Very easy
It's free!
Don't pay for weather APIs
National weather service is free and good
Raw model data is also free
Even the notes they're taking
Forecast function takes in URLs and outputs JSON
Freya also wrote scripts for brightness and volume
Wants to bind it to a shortcut
Inspiration
Bread on Penguins
Videos showing scripts
Automated with ffmpeg
Cool things
One more thing
LUG lan party 3 on Sunday
End