Shell scripting general. Post your shell scripts and give feedback on other anons'. Discuss command line utilities and useful programs. Shitpost about bash vs. zsh vs. ksh vs. fish. Share your dotfiles. Have fun.
>Resources for learning / improving tldp.org/LDP/abs/html/ - Advanced Bash-Scripting Guide: An in-depth exploration of the art of shell scripting. shellcheck.net/ - Shell script analysis tool. Catches syntax errors and bad code. Available from the command line. explainshell.com/ - Paste a shell command and it will explain the commands and arguments. Reading the manpages is actually often quite helpful.
>Videos to get you in the mood youtu.be/8E8sUNHdzG8 - Luke Smith: Layin' down Pipes like a Unix Chad youtu.be/w_37upFE-qw - Luke Smith: Unix Chad JUST WON'T STOP Piping! youtu.be/QaGhpqRll_k - Luke Smith: Using `sed` and Regular Expressions
>Topics of conversation Good composable programs that you've found. Tips and tricks you've recently discovered. Scripts you've written to improve your workflow.
You know, not everything needs a general. Better than 90% of the rest of this crap board anyway.
Christian Cooper
use jq
Lincoln Gray
This resource is a lot better than TLDP. IMHO TLDP is actually a shit resource.
Charles Ortiz
cd .. dir cd ../.. dir cd ..
Jordan Wood
this but compile from source, stable versions are slow as fuck
Hudson Allen
Luke is a brainlet when it comes to shell scripting
Noah Hughes
GNU Coreutils aren't Unix utilities. They have been written from scratch for the GNU system. It's not only wrong to call these things Unix utilities, it also gets you into legal trouble or fun (depending on the POV): Years ago, the Linux kernel team actually got lawsuits for stealing proprietary Unix code in its system and utilities. Judt call them GNU utilities.
Bentley Collins
Agreed. He's riding the POSIX train.
Ethan Butler
Stop trying to force another general. If you want to make a fucking thread about this, just make a thread about this. Or even just post in /dpt/. It's pretty pathetic that you spent time preparing this bloated OP that nobody is going to read.
Yes. Jow Forums has too many fucking generals, and many of them are way too specific. Unless a general is about a wide topic that will always have potential new discussion (e.g. /dpt/) or is otherwise containing a lot of otherwise annoying/useless threads in one place (e.g. /sqt/), it's a fucking useless general. Anything ultra-specific or otherwise devolves into a circlejerking chatroom is a bad general.
Robert Evans
Jow Forums is broken already user. Just lets have fun.
Isaiah Foster
i like this general, way better than another apple thread
Asher Nelson
ill post in here, its the best general on this board
Carson Clark
I like this thread.
Nicholas Carter
me too
Isaac Carter
Good thread.
Carson Allen
>luke smith
GTFO
Elijah Gonzalez
PowerShell makes it unnecessary. You can just pass complex objects from 1 script to another.
Caleb Rodriguez
>powershell no
Samuel Allen
Anyone using mksh? I have it installed but I need a resource to compare features. Stupid simple stuff like the prompt and history.
Caleb Taylor
#! /bin/bash
sleep 2 && scrot -s -q 100 "$HOME/.scrots/temp.png"; if [ ! -z $1 ]; then convert -liquid-rescale 200% "$HOME/.scrots/temp.png" "$HOME/.scrots/temp.png"; fi xclip -i -selection clipboard -t image/png < "$HOME/.scrots/temp.png";
script I wrote that copies a region from scrot into the clip board. its basically equivalent to snip tool, or sceen print & paint. could be more inspired
Gavin Evans
Generals are a fucking stupid idea brought by redditards and other scum. Jow Forums is not a forum.
Jeremiah Peterson
doesnt work faggot
Adam Cook
whats a cd ../..
Andrew Smith
Mandatory. Screenshots with imagemagick import -window root png:$HOME/x_$(date "+%Y-%m-%d-%H:%M:%S").png
Record desktop and stop recording if you bind it to the same key killall -INT avconv 2>/dev/null || avconv -f x11grab -r 10 -s $(xrandr | grep '*' | tr -s ' ' | cut -d ' ' -f2) -i :0.0 $HOME/x_$(date "+%Y-%m-%d-%H:%M:%S").mp4 &
I bind both to the print screen and shit using xbindkeys.
Aaron Thompson
Sorry, forgot to say the desktop recording is using avconv. Just change it to ffmpeg, is the same shit.
Luke Perry
without generals Jow Forums would be way worse than it already it is please dont swear
Juan Bennett
Trying to make a simple script to get the resolution and pass it to mplayer and watch videos on the framebuffer. exiftool -ImageSize "$1" | tr -s ' ' | cut -d ' ' -f4 | tr x '\n' | sort -n | tail -n1 Not sure if it works as good as I think, I need the highest resolution that exiftool can give.
Bentley White
Yes.
Logan Adams
Be thankful the other guy asked politely not to swear or I would be all over mocking you.
Grayson Torres
Microshitters btfo
Landon Rivera
i like shell script and anime
Jace Wood
works great. you probably need to make the ~/.scrots folder, or rename it to whatever you want. dont be a retard on the internet
Joseph Gray
why [ ! -z $1 ] instead of [ -n $1 ] ?
Jacob Adams
you are shit resource, TLDP is leet af
Brandon Baker
Is there a way to copy a .jpg image using xclip? I want to use ranger as my file manager exclusively, but the script I wrote only works with png #!/usr/bin/env ruby filename = ARGV[0] || abort('[!] Please specify an image.') format = File.extname(filename).tr('.', '').to_sym[/png/] || 'jpeg'
system "xclip -selection clipboard -t image/#{format} -i #{filename}"
Redpill me on sed. I have literally never once found an excuse to learn it, I almost always use awk instead. Is it just a matter of preference, or "the right tool for the job" where being familiar with one but not the other makes it right for almost all jobs, or are there really tasks where awk is strictly inferior to sed?
James Butler
Sed is simpler for 1 off text manipulation tasks. It’s very readable and easy to test outputs before writing inline (if that’s what you’re trying to achieve). You should be able to do everything that sed does in awk, but with MUCH more control
Sebastian Wood
It's full of bad practices senpai.
Luis Anderson
Friendly reminder to write portable shebangs. #!/bin/sh for POSIX shell #!/usr/bin/env bash for Bash, and similarly for other non-standard interpreters.
Parker Bailey
...
Carson Parker
What are the best resources for pure shell scripting, just sh?
Adrian Sullivan
Friendly reminder that writing portable scripts is for cuckolds. Be proud of your system and don't bother about shit systems. If people want to run your script, they have to switch to a superior system.
Totally useless yes. The only thing I can think of to make a regular thread about a specific topic is to make a weekly or monthly or something like that. I can imagine there would be an okay amount of discussion for slightly more niche topics if there only was a thread at a certain time interval. I can imagine an Emacs weekly being nice for example.
Cameron Anderson
dl imagemagick and add a line to convert from png to jpg or vice versa.