Artwork

Content provided by HPR Volunteer and Hacker Public Radio. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by HPR Volunteer and Hacker Public Radio or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://ppacc.player.fm/legal.
Player FM - Podcast App
Go offline with the Player FM app!

HPR3625: Shell Tips and Snippets - Collaborative Effort

 
Share
 

Manage episode 446211217 series 2795599
Content provided by HPR Volunteer and Hacker Public Radio. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by HPR Volunteer and Hacker Public Radio or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://ppacc.player.fm/legal.
Carl talks about a method to move function definitions to the bottom of a script using sed: #!/bin/sh source <(sed '1,/^exit/ d' $0) __say "hello" exit __say() { echo $1 } Guest Host #1 (scroll to the bottom to ruin the surprise) talks about the shift command using this example: startdate="$1" # Pick up date shift days=0 # Loop through args and create events while [ $1 ] ; do # as many times as you add a timestamp [ $1 != "off" ] && khal new $(date -j -v+"$days"d -f %Y-%m-%d +%Y-%m-%d $startdate) $1 8H Work let days++ shift done Guest Host #2 provides tips and examples on how to use variables safely and politely provide default values. One example of assigning a default value is: foo=${foo:-"blah"} Carl then closes out with the : (colon) shell builtin and provides a variation on the above default value: : ${foo:="blah"}
  continue reading

116 episodes

Artwork
iconShare
 
Manage episode 446211217 series 2795599
Content provided by HPR Volunteer and Hacker Public Radio. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by HPR Volunteer and Hacker Public Radio or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://ppacc.player.fm/legal.
Carl talks about a method to move function definitions to the bottom of a script using sed: #!/bin/sh source <(sed '1,/^exit/ d' $0) __say "hello" exit __say() { echo $1 } Guest Host #1 (scroll to the bottom to ruin the surprise) talks about the shift command using this example: startdate="$1" # Pick up date shift days=0 # Loop through args and create events while [ $1 ] ; do # as many times as you add a timestamp [ $1 != "off" ] && khal new $(date -j -v+"$days"d -f %Y-%m-%d +%Y-%m-%d $startdate) $1 8H Work let days++ shift done Guest Host #2 provides tips and examples on how to use variables safely and politely provide default values. One example of assigning a default value is: foo=${foo:-"blah"} Carl then closes out with the : (colon) shell builtin and provides a variation on the above default value: : ${foo:="blah"}
  continue reading

116 episodes

All episodes

×
 
Loading …

Welcome to Player FM!

Player FM is scanning the web for high-quality podcasts for you to enjoy right now. It's the best podcast app and works on Android, iPhone, and the web. Signup to sync subscriptions across devices.

 

Quick Reference Guide

Copyright 2025 | Privacy Policy | Terms of Service | | Copyright
Listen to this show while you explore
Play