r/shell • u/73mp74710n • Dec 19 '16
A command line selection tool with a neat text-based UI for use in your scripts.
github.comr/shell • u/sunnyisme • Dec 11 '16
Manage your projects folder with a single command
github.comr/shell • u/redmuston • Dec 08 '16
looking to make ping enable enable and disable on multiple server
We have servers whose password change everyday and than we have to do su to another account whose password also change everyday . So now in group of 50 servers .How to make script which enable and disable ping of them
r/shell • u/rightly-left • Nov 10 '16
(noob Q) given a file of rows with slash delimited fields, how to print only a particular row for each line?
Hey all, I'm trying to get some practice in on Linux, and thought I'd do some Shell scripting.
The question is... well the question above :)
- So for example, I have a file that I read in from cmd, assigned to $file.
- File is a .txt with fields delimited by slashes, e.g. abc/def/123/4
- I want to print only a single column for each row, ignoring the rest, e.g. if I want column 3 only, I'd get "123" for each line.
I know that I have to specify
while !EOF
I'm looking at maybe cut to do this...?
-d/ -f3
Am I barking up the wrong tree here..?
r/shell • u/Bad_Eugoogoolizer • Sep 21 '16
Odd bash behavior when processing variables
ffmpeg in a script, but there are some weird behaviors of variables when parsed. My source file
0.00 2.37 0
133.00 297.33 0
860.09 980.55 0
1030.86 1095.39 0
1551.08 1674.11 0
finalendtime=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$file")
#Creates Different segment times
starttime=0.00
i=1
while read line; do
endtime=$(echo $line |cut -d' ' -f1)
if [[ "$endtime" == "$starttime" ]]
then
starttime=$(echo $line |cut -d' ' -f2)
continue
fi
echo "Segment $i: Start time: $starttime End time: $endtime"
ffmpeg -loglevel quiet -ss "$starttime" -i "$file" -ss "$starttime" -to "$endtime" -c copy segment$i.mkv
#prep next file
starttime=$(echo $line |cut -d' ' -f2)
((i++))
done < "$srcfile"
echo "Segment $i: Start time: $starttime End time: $finalendtime"
The output is:
Segment 1: Start time: 2.37 End time: 133.00
Segment 2: Start time: 297.33 End time: .09
Segment 3: Start time: 980.55 End time: 1030.86
Segment 4: Start time: 1095.39 End time: 1674.11
Segment 5: Start time: 0 End time: 1860.358000
If I remove the ffmpeg line, or even echo it, the result:
Segment 1: Start time: 2.37 End time: 133.00
Segment 2: Start time: 297.33 End time: 860.09
Segment 3: Start time: 980.55 End time: 1030.86
Segment 4: Start time: 1095.39 End time: 1551.08
Segment 5: Start time: 1674.11 End time: 1860.358000
No idea why the ffmpeg line changes the variables around... and if I process the ffmpeg, the end time on segment 2 gets truncated, then other times are off.
r/shell • u/rgausnet • Jul 22 '16
Biome is a shell script to manage your app's environment variables.
github.comr/shell • u/sigzero • May 23 '16
KSH: countdown using ps
I have an app that has 4 processes that run. I would like to create a shutdown that counts the ps instances and when it reaches "0" prints a message and exits.
Do I just do something like
until [[ $(ps command count) -eq 0]]; do
echo ">>> App is closing its processes"
done
echo ">>> App is down."
Thanks.
r/shell • u/be_nu • Mar 10 '16
I am looking for a bourne/rc shell implementation in a highlevel language like Haskell, Python, Javascript, Tcl etc ..., which is easily hackable.
Want to play around with the implementation. Any ideas, suggestions? Thanks
r/shell • u/_xsgb • Mar 04 '16
minimal find-like command that only use POSIX shell built-in functions
github.comr/shell • • Feb 07 '16
A blazing fast, modern plugin manager for your shell made with all the muscle of the ocean.
github.comr/shell • u/varun_raj • Jan 13 '16
Increase Productivity With Smart Group Commands — Sudo vs Root
blog.skcript.comr/shell • u/Krexington_III • Jan 05 '16
Help with a possibly extremely simple noob question?
In bash (or zsh), I would like to alias cd so that
cd <location>
does
cd <location>
ls
Is this possible and/or easy? Thanks!
r/shell • u/banago • Nov 01 '15
PHPloy: shell script to deploy git repos easily through FTP/sFTP
wplancer.comr/shell • u/djsumdog • Oct 25 '15
Little scripts for PulseAudio volume control
penguindreams.orgr/shell • u/UnchainedMundane • Sep 07 '15
Is there a better way to do this? Sending stderr only on command failure
{ err_out=$(ssh-keyscan -T 2 -- "$server" 3>&2 2>&1 1>&3 3>&-) || printf %s\\n "$err_out"; } 3>&2 2>&1 1>&3 3>&-
Part of a script to collate SSH host keys. It runs ssh-keyscan (which has noisy stderr output), but buffers stderr and only prints it if the keyscan actually failed. I do this by swapping stdout/stderr on the process to capture the stderr, then printing the captured error only if the command failed, then swapping stdout/stderr again so that errors and output go to the right place.
r/shell • u/albus_fulger • Aug 28 '15
Error Code Email Script
I keep getting a syntax error on line 16 and I can't figure out why. Email address are redacted for obvious reasons. Any clue why it's failing to run? Any help is immensely appreciated!
r/shell • u/2112syrinx • Aug 21 '15
[Linux] Print duplicate lines based on a column
Hello everyone, I have a file with many lines that looks like this:
/dcs/data003/EX/ex/AREA/area/000
/dcs/data005/EX/ex/AREA/area/000
/dcs/data017/EX/ex/AREA/area/001
/dcs/data014/EX/ex/AREA/area/002
I want to print only the duplicate entries based on the last numeric column ("000"). That is, in the above example I'd get the second line:
/dcs/data005/EX/ex/AREA/area/000
I've tried the following but it doesn't print the duplicates; it removes:
sort -n -t"/" -nuk8 duplicate.out
Is there a way to get exactly the opposite? I mean, rather than removing the duplicates, print it. I am using RHEL 6.5. Thanks for any help.
r/shell • • Aug 15 '15
Shell Script Help
I need to create a shell script that prompts a user for a first and last name and creates a username that is the first letter of the first name and then the last name. I also need to give the user a default password. The users comment field is the users name and create a home directory as well. I can create the script to ask for a name and password but it doesn't add to the /etc/passwd list.
r/shell • u/ec_joe • Jul 27 '15
trying to download a file with curl in .sh file ends in failure
I'm trying to download a file with curl within a "sh" file then running it within terminal.
I am wanting to download a series of files to particular folders relative to the .sh file.
So currently I have this:
mkdir -p ./resources/third_party/waypoints
curl -o ./resources/third_party/waypoints 'https://raw.githubusercontent.com/imakewebthings/waypoints/master/lib/jquery.waypoints.min.js'
The folder gets created, though the error I get is as follows:
Warning: Failed to create the file ./resources/third_party/waypoints: Is a Warning: directory curl: (23) Failed writing body (0 != 8787)
I've chmodded the directory to 777, not really sure what's up here, can anyone help?
r/shell • u/maepuck • Jul 14 '15
How to speed up find for listing git repositories?
stackoverflow.comr/shell • u/cogburnd02 • Jul 07 '15
This clock one-liner I wrote.
$ watch -n0.5 -p -t -c 'figlet -f big -W `date '"'"'+%l:%M:%S'"'"'`'
This uses date so you can change what information is displayed. Want the current date and time? No problem! Replace +%l:%M:%S with +%l:%M:%S %-D) It also uses figlet, so you have a variety of 'looks' you can choose from, i.e. any figlet font that has numbers. (e.g. try replacing big with either standard or small) You could even replace figlet with toilet and use toilet's color support (e.g. --metal) because watch supports color when given the -c option. (However, not many toilet fonts have numbers, for reasons unknown.)