-
Tweets381
-
Followers814
-
Following0
-
Likes3
JP & Carl are back with the next step to increase your bash skills - "bash Idioms" - just out from O'Reilly.
Busy Monday afternoon? I'm giving a tutorial on bash at #OSCON Austin TX; I'd be happy to see you there. Introduce yourself during a break.
This Monday evening, live in Annapolis, Carl talks on bash at the Annapolis Linux User's Group. annapolislinux.org
bash has a builtin printf so it's fast, like echo. Use printf -v MYVAR '%fmt' args to"print" into the variable MYVAR.
M=Merry;C=Christmas;for ((c=0;c<12;c++)); do echo $M $C; done # it's simple but says it well enough
Odd use of :+ to change a variable and echo its new value in one line: echo ${VAR:+${VAR,,}} converts it to l/c and echoes it, too.
More with "!": You can list all your shell variables starting with "SH" this way: echo "${!SH@}" use only literal characters not patterns.
${!name} is an indirect reference; if name=value then ${!name} is the same as ${value}. ${#} is the arg count; with 5 args ${!#} becomes $5
Only a few hours left: #CyberMonday : Save 50-60% on ALL video training & ebooks + more deals: oreil.ly/Cyber-Monday via @oreillymedia
A quick way to reference the last parameter given to your shell script: ${!#} So call myscript.sh a b c d e If you echo ${!#} you'd get "e"
Had a great time at SC'15 last week (sc15.supercomputing.org) - heard several people wish that users had better bash skills. Follow us!
Use [[ "123abc456" =~ ([0-9]*)([a-z]*)([0-9]*) ]] to parse a string via regex; echo ${BASH_REMATCH[0]} for what matched; pieces in [1], ..
What's the ONLY place in shell that uses regular expressions (regex)? It's the =~ comparison as in: if [[ $NUM =~ ^[0-9]{1,3}$ ]] ; then ...
Normally empty, CDPATH can be :-separated list of directories for when you type "cd path" (unless path is absolute). Try: CDPATH=".:~"
Do you type this a lot: cmd 2>&1 | other - to redirect both std out & std err into the pipe? Now there's a shorthand: cmd |& other
If you declare an integer, then you can use += to add to its value with or without the $(( )) around the right hand side - but no spaces!
You don't have to declare x as integer to do math; just put the expression inside dollar-double-parens as in: x=$((5+4)) ; echo $x gives: 9
Try this: x=5+4; echo $x and you get "5+4" of course. But first: declare -i x (which says x will hold integers) then echo $x gives: 9.
Been too long - time to re-start tweets on bash; there's always more to learn and handy short-cuts worth knowing.
Our book cover is pink so it's part of @OReillyMedia's Valentine's day promo - see the deal at: oreil.ly/1CoU3N5 HappyValentinesDay!
Command Line Magic @climagic
186K Followers 10K Following Cool Unix/Linux Command Line tricks you can use in $TWITTER_CHAR_LIMIT characters or less. Here mostly to inspire. Also on https://t.co/YYJE9JpVnF
Tania Diaz @taniadivi
14 Followers 171 Following I'm not trying to impress you, but I have a twitter account
No Name @NoName63244774
0 Followers 30 Following
c-x n s c-x n w 🌾 @adolflow
3K Followers 5K Following cultura libre, web semántica, sindominio, datalab, periodismo de datos, sanidad y educación pública, para empezar
Cordigliere PhD @FprocTail
24 Followers 425 Following
Nick @nickOppersdorff
61 Followers 449 Following
mike johnson @reddrum
313 Followers 2K Following Pro Minigolfer Captain USA Minigolf Team Putt Putt National Champion Cybersecurity Pen Tester #!/usr/bin/perl
MM @mm1976x
11 Followers 94 Following
SJ @jaskasilva
45 Followers 481 Following
Runbooks @RunbooksApp
16 Followers 156 Following If you've ever wanted a really great checklist / runbooks / playbooks tool for your team, I think you'll really like what we do!
Dilburt @Pikavader
136 Followers 4K Following
Matheus Lozano @LozanoMatheus
146 Followers 753 Following #Bash #Linux #SysAdmin #DevOps #SRE #Ansible #Tuning #ChaosEngineer #Kubernetes #Cloud
Sabine Matthys @SabineMatt
0 Followers 40 Following
Andries Burger @andriesburger
1K Followers 5K Following Computer Specialist in Financial industry (Oracle DBA, SQL Server DBA, SSIS/SSRS, UNIX/AIX/Linux, IBM SAN)
Pirate @vvigneshwar
87 Followers 1K Following
Jacob McCrumb @MccrumbJacob
1 Followers 3 Following
Sarah Conway @xenophenes
488 Followers 548 Following Tech Evangelist, Developer Advocate, Tech Writer, & Marketing Consultant || Owner @ Talk to Me About Tech 🤖 || Follow for tips using tech for success ✨
Robbie Honerkamp @robbiehonerkamp
396 Followers 3K Following Tech eng/ops manager: security, open source, WiFi, NOC/SOC/SRE/BBQ, cloud, buzzwords. Hates the word "cyber". "Crypto" doesn't mean currency. Come at me bro!
Bad Hombre (very stab... @chibaolema
325 Followers 3K Following This is my bio. I do lots of stuff with things. It's a haiku too.
UofRSeismo @UofRSeismo
225 Followers 491 Following Research updates, community happenings, and exciting science from the @UofR seismology group: probing Earth's interior using recorded ground vibration.
Owen @OwenITGuy
102 Followers 181 Following
Mr70b0t @mr70b0t
14 Followers 94 Following
Paul Lysander @palysander
279 Followers 7K Following
jacky_yue @jacky_yue
32 Followers 3K Following
ogami itto @ogamiitto54
304 Followers 702 Following Conservative, anti-liberal Trump supporter. Let's get back to traditional values.
Trevor Pan Architect @tpanarchitect
404 Followers 3K Following Artistic clarity ~ Monument Builder. Founder: @BidBird_Inc. Organizer for @DesertPy
Seth Bergman @seth_bergman
142 Followers 840 Following Music Producer and Software Maestro https://t.co/lENjE6DLCX
Benjamin @bewuethr
129 Followers 307 Following I think you could do it with a small shell script instead
End Summer Camp @endsummercamp
793 Followers 3K Following Hacking, Free Software, DIY -since 2005! 👾 Next CAMP (20th edition): 📅 Sept.2024 🌍 San Dona'(Venice Metropolitan Area) 🌈 Registrations are OPEN! ⬇️
SoftwareArchitecture @OReillySACon
9K Followers 585 Following Learn about the training that all veteran & aspiring software architects need.
purpakana @purpakana
1 Followers 7 Following
László Zsolt Szabó @laszlo8
10 Followers 93 Following
Emanuele Riganelli @e_riganelli
46 Followers 264 Following
Andrea Borruso @aborruso
4K Followers 4K Following The Cat in the Hat Can Map This and That! #data #maps #GIS #baci #condivisione. Orgoglioso di essere presidente di @ondatait #AutoritàCompetente
Seth @tsethaskew
504 Followers 987 Following
Weverton Marques @wevertonmarx
71 Followers 847 Following Sabe aquelas pessoas que são gratas por tudo que tem? Sou desses! Nem por isso pretendo parar por aqui...
Boy-Code-It @boycodeit
509 Followers 2K Following Making sure people know about code! Our single principle is ABC -- Always Be Coding. https://t.co/NSGotJ9FGR, https://t.co/f8xL4ZJclh
João Muniz @munizjc
72 Followers 1K Following
mark adams @emailma220
5 Followers 76 Following









