420chan now has a web-based IRC client available, right here
Leave these fields empty (spam trap):
Name
You can leave this blank to post anonymously, or you can create a Tripcode by using the float Name#Password
Comment
[*]Italic Text[/*]
[**]Bold Text[/**]
[~]Taimapedia Article[/~]
[%]Spoiler Text[/%]
>Highlight/Quote Text
[pre]Preformatted & Monospace text[/pre]
1. Numbered lists become ordered lists
* Bulleted lists become unordered lists
File

Sandwich


Community Updates

420chan now supports HTTPS! If you find any issues, you may report them in this thread
Random Bash Scripts by Jarvis Susslelock - Mon, 15 May 2017 17:26:19 EST ID:BSmRhOy1 No.36917 Ignore Report Quick Reply
File: 1494883579283.jpg -(42222B / 41.23KB, 506x600) Thumbnail displayed, click image for full size. 42222
>You have some *.aac files and you want to convert these to *.mp3 files with the "ffmpeg" utility. Use the "-i" and "-acodec" options for ffmpeg and add ".mp3" to each found *.aac file's base part (the part without ".aac"). Hint: "man bash" and "Parameter Expansion".

#!/bin/sh

check () {
(
dir="$(dirname "$1")"
cd "$dir"
if git remote | grep -e '^origin$' >/dev/null
then
echo "==> $(basename "$dir") <=="
git fetch -t -p origin
$SHELL
fi
)
}

for repo in $(find . -type d -name .git)
do
check "$repo"
done
>>
Jarvis Susslelock - Mon, 15 May 2017 17:27:10 EST ID:BSmRhOy1 No.36918 Ignore Report Quick Reply
>Create a bash script that check the number of command line arguments and prints "Errornvalid number of arguments." if the amount is not 2 it returns with code 2.

#!/bin/bash
if [[ "$#" -ne 2 ]];
then
echo "Error: Invalid number of arguments."
else
echo "code 2"
fi
>>
Jarvis Susslelock - Mon, 15 May 2017 17:28:53 EST ID:BSmRhOy1 No.36919 Ignore Report Quick Reply
>>36917
oh son of a bitch this was the wrong one the description of this script is

>Create a bash script that manages your own git repositories. You have your own git repositories in one directory (done with "git clone <address>") and the script should enter each of these subdirectories (let's call them "projects"). When a project is found with supported configuration, the project is updated with "git pull" and successful update can be checked from the non-existence of the "Already up-to-date." string.

#!/bin/sh

check () {
(
dir="$(dirname "$1")"
cd "$dir"
if git remote | grep -e '^origin$' >/dev/null
then
echo "==> $(basename "$dir") <=="
git fetch -t -p origin
$SHELL
fi
)
}

for repo in $(find . -type d -name .git)
do
check "$repo"
done
>>
Jarvis Susslelock - Mon, 15 May 2017 17:43:32 EST ID:BSmRhOy1 No.36920 Ignore Report Quick Reply
Anyone wanna do this one?

>Create a bash script that uses "rsync" command for backups and restores. The first argument should be either "backup" or "restore" and the second one is an optional argument specifying "realrun". The purpose of the "realrun" option is to avoid applying changes that won't be correct changes (without the option). If "realrun" is not set, use "--dry-run" option in rsync. Note that rsync supports huge number of different options. The most important ones are "--archive", "--relative", "--verbose", "--progress", "--human-readable", "--delete" for backup. Delete will cause changed not yet backed up to be lost. One option is to use the "--include-form" option for including only specific directories.


Report Post
Reason
Note
Please be descriptive with report notes,
this helps staff resolve issues quicker.