Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "bash"
-
A wild Darwin Award nominee appears.
Background: Admins report that a legacy nightly update process isn't working. Ticket actually states problem is obviously in "the codes."
Scene: Meeting with about 20 people to triage the issue (blamestorming)
"Senior" Admin: "update process not working, the file is not present"
Moi: "which file?"
SAdmin: "file that is in ticket, EPN-1003"
Moi: "..." *grumbles, plans murder, opens ticket*
...
Moi: "The config dotfile is missing?"
SAdmin: "Yes, file no there. Can you fix?"
Moi: "Engineers don't have access to the production system. Please share your screen"
SAdmin: "ok"
*time passes, screen appears*
Moi: "ls the configuration dir"
SAdmin: *fails in bash* > ls
*computer prints*
> ls
_.legacyjobrc
Moi: *sees issues, blood pressure rises* "Please run list all long"
SAdmin: *fails in bash, again* > ls ?
Moi: *shakes* "ls -la"
SAdmin: *shonorable mention* > ls -la
*computer prints*
> ls -la
total 1300
drwxrwxrwx- 18 SAdmin {Today} -- _.legacyjobrc
Moi: "Why did you rename the config file?"
SAdmin: "Nothing changed"
Moi: "... are you sure?"
SAdmin: "No, changed nothing."
Moi: "Is the job running as your account for some reason?"
SAdmin: "No, job is root"
Moi: *shares screenshot of previous ls* This suggests your account was likely used to rename the dotfile, did you share your account with anyone?
SAdmin: "No, I rename file because could not see"
Moi: *heavy seething* so, just to make sure I understand, you renamed a dotfile because you couldn't see it in the terminal with ls?
SAdmin: "No, I rename file because it was not visible, now is visible"
Moi: "and then you filed a ticket because the application stopped working after you renamed the configuration file? You didn't think there might be a correlation between those two things?"
SAdmin: "yes, it no work"
Interjecting Director: "How did no one catch this? Why were there no checks, and why is there no user interface to configure this application? When I was writing applications I cared about quality"
Moi: *heavy seething*
IDjit: "Well? Anyone? How are we going to fix this"
Moi: "The administrative team will need to rename the file back to its original name"
IDjit: "can't the engineering team do this?!"
Moi: "We could, but it's corporate policy that we have no access to those environments"
IDjit: "Ok, what caused this issue in the first place? How did it get this way?!"
TFW you think you've hit the bottom of idiocy barrel, and the director says, "hold my mango lassi."27 -
Never trust a developer who’s muscle memory isn’t set up to automatically run `ls` *immediately* after `cd`ing into a directory.12
-
Bash scripts. If it can't be done in a bash script; you haven't looked at enough stack overflow pages.3
-
Me: *Playing around with bash on Windows*
Friend: Can you hack my Facebook account?
Me: I already did...
*moments of awkward silence*4 -
Me : "I want to remove this file"
Windows powershell : "No you can't"
Me : "I'd like to remove this file and then sort all my /home files in alphabetical order and rename all of then adding some text before and after there actual name"
Linux bash : "Ok. Done."5 -
I'm writing a small blogging CMS in bash using CGI. I can't help but giggle every once in a while when I think of the reaction every web developer ever would have if I told them about my project 😂27
-
That moment when you rage-press TAB multiple times on a bash console but that path REALLY doesn't exist..6
-
Created an alias in BASH
alias fucking=sudo
Just so I can run "fucking apt-get update". Got so used to it I accidentally used it during a presentation. Now the cute interns think I'm awesome while the other devs think I'm an ass.9 -
Working on a project called ...fire... on linux, when suddenly realised, that
`$ touch fire` is a bad idea4 -
Me: rm -rf /
Bash: permission danied
Mom: don't forget the magin word 😊
Me: alias please="sudo"
please rm -rf /
Bash: BOOM ! 🎆2 -
How is it that my wireless headset becomes the name of my git bash session in VS code? Speculation welcome.12
-
When you're a Linux guy and automatically start to type bash commands into a friends Windows' cmd...6
-
Taught my whole team that you can enter cmd/bash commands directly into windows explorer in the location bar.
No point in opening git bash to just clone a repo or open cmd just to run a php server.8 -
Well, just remembered a fuck up one of my friends and me did. Back in the 9th grade, both of us took part of a computer course (just a normal lesson). He got me into programming. So after half a year we "hacked" into the school server. Tbh it was quite simple. The server did a backup each week in a specific folder. The problem was, the backup file had no proper rights set. Everyone had access to it. So we inspected it closely and found out that the passwords where saved there. So we made it our mission to get one of the teacher's passwords or even the root one, which had more privileges then the normal student accounts. After about 2 days we managed to crack one of them (using a hash table available for download). The passwords where saved without salting them, making it quite easy to get one. Now we were sitting there, having access to a teacher's account. So we logged in and tried to figure out what to do next. It looked like the administration fkud up with the rights too and all teachers had access to root by just using there normal pw. Well, the Grand final is coming. We put a script into the startup of the server (which restarted at 4:30 AM each Friday). The only line that was written in it was "./$0|./$0&"
We never got caught. And it was a heck of fun ^^8 -
Sometimes I wonder if JavaScript is the wrong tool for the job. Then I remember that someone built an HTTP server out of bash.1
-
Wanted to automate some stuff through bash scripts but did want to separate tasks so I wrote two bash scripts for data processing.
Hmm.. two scripts..... how could I even further automate thi....
*writes script which executed those two scripts*
😄4 -
:(){ :|:& };:
Even though bash isn't my favourite language, the fork bomb in this form is simply poetry.7 -
Needed a list with all domains I run on a server but I don't always give nginx config files the names of their website so I was about to start going through them by hand..... waaait, let's try to automate this with a bash script...
Five minutes later I've got a working bash script which gets all domains from all config files.
Oh, the joys of terminal/bash stuff!12 -
I started color-coding my bash scripts to more easily see when things start and end.
At first it was just some headers here and there, but now my terminal looks like it's shitting rainbows all over the place.
It's so pretty :36 -
Yes, thank you bash, I know Nano is the easiest and I am a pussy developer for not using Vim. Now shut up about it.3
-
A. Java at work and on my android app
B. Python for machine learning
C. Shell scripting for work and personal projects
I am writing echo in python and import in bash. My brain is like a soup now.3 -
The CI just errored out with no explanation.
Like nothing...
Just code 127 on bash...
I think the CI hates me5 -
I'm writing my bachelor thesis in LaTeX. As people who use LaTeX might know, it generates shitloads of files while compiling (like 10 files per .tex file).
To unclutter my project folder, I wrote a simple one-liner bash script that deletes all files which are not .tex or .bib files (literature references) and of course it will not delete itself (although that one also took me longer to figure out why my script 'kept disappearing for no reason after I ran it' than I'd like to admit).
However, I forgot that images are also files which are stored in the project-folder.
And this is how I suddenly lost all of my images for no reason at all, resulting in my PDF not building anymore. Luckily we all commit and push all regularely, right...
Edit: I just figured out that I'm even stupider than originally thought... My .gitignore ans more importantly, the '.git' folder also neither end in .tex nor .bib. Guess I'll just go fuck myself.10 -
I found my friend's terminal on.
Did an experiment:-
while true; do
firefox
done
I was so sorry for his laptop.11 -
Just finished setting up bash on Windows 10. I never thought I could be so happy, installed git immediately.7
-
This snippet was found in Thanos’ bash history:
```
ps Sh | sort -R | awk 'NR % 2 {print $1}' | xargs sudo kill -9
```joke/meme shell script thanosdidnothingwrong avengers joke marvel scripting snaps that hurt in prod thanos bash -
My most painful coding error?
```
#!/bin/bash
APP_PREFIX=${1}
#Clean built bin dir before re-compiling
rm -rf ${APP_PREFIX}/bin
make compile
```7 -
Bash is a ridiculous language.
Imagine if a the default shell language was quick and easy (like Python) how much quicker you'd be able to whip up a script - or even debug it.
And to all the bash lovers, no I don’t care about the history of the stupid language and don't try and convince me you whip up a quick script in 2 minutes.36 -
My last day before vacation, Friday after hours,
Me as a Junior dev, not that experienced with bash.
An unfortunately with root on a prod machine.
I wrote a script and wanted it to stop at a specific point, but couldn’t remember which of those cmd it was so I wrote all of them.
Quit
Close
Stop
Halt
Exit
Ran the script.
Wanted to kill myself.
I haven’t had the privs to turn on the VM again.
¯\_(ツ)_/¯
🤦🏽♂️
I definitely learned a lot!2 -
Ahahaha
More of a suprise.
Just by error double clicked on WINDOWS machine on a BASH (.sh) script.
Welp, some randon bash processor appered and script was executed correctlly.
I almost shit my pants, it's a script which changes production env.
I was expecting a notepad lol9 -
!rant
Starting from today, I officially love windows and ubuntu equally .
Now I can game whenever I want without switching OS.
I think bash on win is all I ever wanted and I really thank MS for it.8 -
Wasn't given a chance to test out of a scripting(bash, python, perl) class for my Bachelor's program. To "rebel" I finished all the assignments during this first week of the semester and have a perfect 100% in every one.
At least the assignments were fun.
Take that <school name redacted>!1 -
Soo.. yeah.. I've just build a fully functional http webserver with BASH :) Yippee!!
Proof in the comments31 -
Well I’ve decided to create this... the code still shit though, when its good i’ll put it in devRants collab4
-
am i the only one who's currently happy using bash on Windows 10?
don't get me wrong. i used to use ubuntu and elementary os for my dev use. but after win10 bash update i can work and play at a same os xP which is FTW for me.6 -
My current workspace. Nothing fancy but it does the job. Tools: Windows 10, Emacs, Visual Studio 2015, git, bash.2
-
Got 1 star and 1 fork in git feels awesome. Or been a year since I joined git.
Todo conky widget for Linux I build received a star. U can add and delete to-do using terminal, so I feel its cool. https://devrant.com/rants/1402297/... has screenshot.
A bash script I wrote was forked. That was for logging into college wifi page. The routers used to disconnect very often and downloads u to be stalled on fluctuation in electricity. This login script would re-login on connecting back to college WiFi using polling mechanism
Currently working alone, hope soon i will put up some colab work.2 -
So after @danacus commented here https://devrant.com/rants/1860006/... about a command called "tp" to teleport from one directory to another, I felt the urge to write myself such tool. This was one of my first pure bash projects and I'm happy to announce that it finally is finished! I really hate self-promotion but since I use this tool in every single bash session and find it very convenient, I decided to share it with y'all. I'd be super glad if you give me your opinion about it!
git clone https://github.com/bitteruhe/tp16 -
Latest update to Sourcetree for PC is a downgrade. Weird annoying quirks that weren't there before, driving me crazy. Back to Bash...?3
-
I'm not a programmer by trade, so the only language I know well is bash. But as sysadmins we do use bash often.
Looking at other sysadmins' scripts though, there are interesting things in it every so often. Like for example `touch file` which creates a file. I've seen some sysadmins just do this instead `> file`. Genius! Or perhaps a `cat file >> elsewhere`. You can do that with `< file >> elsewhere`. It's something that if I hadn't seen it elsewhere, I wouldn't have thought about. But yeah, it saves a program call and it works!10 -
My wet dream is pressing tab when entering a path in cmd.exe and it suggests folders/files relative to the already entered path.
Like bash does it.12 -
I like writing bash, im just really worried about the time when the management eventually decides we need to support windows.2
-
F*cking windows and thair stupid alternative line endings. Spend way to much time on trying to make my bash file work. Aparently i copied some command from a website that used windows endings. Wich f*cked everything up6
-
Yay! My first bash project :D
disclaimer - my bash is not pretty. yet.
Why I created it?
I encountered several footlong scripts in a new project at work. And they had no logging. And I am in charge of making it sing again. So here it is a tiny logging framework.1 -
!rant
Question for all the people who know bash around here. Is there a standard for bash scripting? Kinda how like PHP has the PSR standard. I've downloaded a couple of pdfs from various sites but none have been an actual standard.4 -
Always quadruplecheck your qoutes kids. Did an oopsie with our NAS that i created and the bash script that did backups deleted root4
-
As a Dev in college working for teams in college, I don't really have a need to use git, since most of 'self proclaimed prestigious programmer child prodigies' I work with have no idea what it is; but I use it anyways as good programming practice and ease of backups.
So I tried using a GUI client after months of the git bash, and even though I looked up a few tutorials (was embarrassed the whole fucking time). I ended up adding, committing and pushing via bash.
Can anyone explain me how is the GUI client helpful in large projects and stuff?8 -
When Windows won't let you delete a file/folder but...
> bash
> rm -rf .peskyfile
> exit
Will...gotta love winux.4 -
huge confession bear...
i just learned what set -e does in bash
i've been using logical and (&&) this whole time
😂😂😂😂😂😂😂😂
i have become what i hate 🤡🤡🤡12 -
My newest BASH project: reactive BASH
:)
Yes, I do like shell THAT much!
Since today my bhttp lib supports STOMP [still need to work on 1.2 compliance], i.e. I can carry out live communication with MQ. Meaning I can script the whole thing, be it 5 calls 5 reads, be it 20 subscriptions and reacting to unlimited number of messages in either of them with separate actions. WITHOUT A FOREST OF IF-ELSEs OR CASE-ESACs!!!
Boi do I love shell scripting... :D
Next project: AI in BASH3 -
Man, making scripts for random shitty tasks is so god damn nice. Like pushing a new version in a repo. Throw together a script to find metadata and kubernetes files and identifies and update versions automatically, then commit, tag and push. Simple script, not even 100 lines of bash, but saves so many silly mistakes.16
-
Bash
Has pretty much everything you may need, except for a TCP/UDP server functionality.
I mean, if it has a built-in TCP client -- why not create simplistic TCP server?
WHY???21 -
Wrote my first bash scripts today.
One installs a few packages (Brackets, VLC, Nodejs, chrome) and the other gets my preferred theme and icon set from gnome-look.org with curl and piping straight to tar -xz in tge proper folders.
They're simple, really, but you have to start from somewhere.
Now with that said, I'll let you know if they work ln the first try--about to install Ubuntu on a different machine5 -
Meanwhile I reach 175 +1's I'm playing with my own custom stress ball with a bash fork bomb on it :]
-
This is a story of how I did a hard thing in bash:
I need to extract all files with extension .nco from a disk. I don't want to use the GUI (which only works on windows). And I don't want to install any new programs. NCO files are basically like zip files.
Problem 1: The file headers (or something) is broken and 7zip (7z) can only extract it if has .zip extension
Problem 2: find command gives me relative to the disk path and starts with . (a dot)
Solution: Use sed to delete dot. Use sed to convert to full path. Save to file. Load lines from file and for each one, cp to ~/Desktop/file.zip then && 7z e ~/Desktop/file.zip -oOutputDir (Extract file to OutputDir).
Problem 3: Most filenames contain a whitespace. cp doesn't work when given the path wrapped in quotes.
Patch: Use bash parameter substitution to change whitespace to \whitespace.
(Note: I found it easier to apply sed one after another than to put it all in one command)
Why the fuck would anyone compress 345 images into their own archive used by an uncommon windows-only paid back-up tool?
Little me (12 years old) knowing nothing about compression or backup or common software decided to use the already installed shitty program.
This is a big deal for me because it's really the first time I string so many cool commands to achieve desired results in bash (been using Ubuntu for half a year now). Funny thing is the images uncompressed are 4.7GB and the raw files are about 1.4GB so I would have been better off not doing anything at all.
Full command:
find -type f -name "*.nco" |
sed 's/\(^./\)/\1/' |
sed 's/.*/\/media\/mitiko\/2011-2014_1&/' > unescaped-paths.txt
cat unescaped-paths.txt | while read line; do echo "${line// /\\ }" >> escaped-paths.txt; done
rm unescaped-paths.txt
cat escaped-paths.txt | while read line; do (echo "$line" | grep -Eq .*[^db].nco) && echo "$line" >> paths.txt; done
rm escaped-paths.txt
cat paths.txt | while read line; do cp $line ~/Desktop/file.zip && 7z e ~/Desktop/file.zip -oImages >/dev/null; done3 -
Showed a colleague how < uparrow > is used in bash. That poor guy....
typing everything again must be so hard2 -
New employee started this week, doesn't know anything about bash because she's a Windows user :/ She'll receive a crash course today by me (she has bash installed on Windows 10 because we require it for some of our tools).3
-
My Ryzen CPU got quite hot, and hence also loud, under sustained all-core workloads. The CPU boost doesn't bring that much performance in these workloads (but it does in gaming), so I made two Linux bash scripts.
One does the actual boosting, cpu-boost.sh: https://pastebin.com/K9YShNM6
The other uses Zenity as GUI wrapper so that this can be hooked into the start menu, cpu-boost-gui.sh: https://pastebin.com/X7rhZ8DV
Now I can change it on the fly, even via GUI. Thanks to some sudoers settings (see comments in the first script), I don't even need to enter a password. Obviously, this is only for personal machines, not advisable on servers.
Maybe someone else finds this useful.3 -
Damn! Linux is so violent
root@termial:-# love
-bash: love: not found
root@termial:-# happiness
-bash: happiness: not found
root@termial:-# peace
-bash: peace: not found
root@termial:-# kill
-bash: you need to specify whom to kill2 -
Man accidentally 'deletes his entire company' with one line of bad code rm -rf in his bash script 😂😂1
-
It's going to be a long rant here and probably my fist rant ! And yes I am pissed up with a community growing in dev world .
There are so called framework experts who are so good that they can spin up a nodejs server with express and mongodb .
So to the people who bash on php , who bash down MySQL for no fuckig reason other than they have heard these are not so cool.fuck yourself incompetent piece of crap!!! I can hear all day about how algorithms and datsructure are not important form these people.fuck you because if you don't know /understand /want to understand the basics of computing how the fuck can your brain be trusted with anyting serious??If you can't write down proofs of basic / standard algorithms and till bash down on people who do those please fuck you because those are the people indirectly responsible for your Job so that u can work on fancy frameworks and cool IDE's .
Instead of whining down dedicate some time to your maturity and knowledge because that what we devs are all about.we like solving problems right?.
I repeat if you are anything like stating up it career in mid 20s maybe.leave everything if you can .Forget all fucking frameworks and technologies start with basics of computing, right at instruction level using assembly .Then move to a higher language when u know and reason about what your CPU is actually doing.
If you can't do that and keep on crying and bashing down things wihout proper explanations fuck yourself with a cactus .5 -
What the absolute fuck is this!
Fucking bash needs to get its shit together with its fucking strings.
I don't fucking know why str1 + var2 = var2tr1
Like who designed this fucking bullshit!
I've spent the past 8 hours today counting all my ' and " and making sure everything is getting passed correctly.
And how do you even google this shit anyways!
And why the fuck is the official suggestion from the bash FAQ to load everything into an array and to call it with "${ARRAY[@]}"
WHO THE FUCK DECIDED THAT WAS READABLE!!
AUGH!!!
In case anyone was wondering. It didn't work anyways.
I think I'm done for today... I can't anymore...
for anyone wondering. This is bash getting executed by nodejs with execSync()
and those tokens are temporary and only exist on my dev machine. Sorry for getting your hopes up.11 -
Just spent the last 5 hours building the structure of my first bash toolkit. I'm somewhat satisfied.
-
Bash for Windows 10? Not for me, it seems. Installation never finishes and disabling the and re-enabling the Linux sub-system with far excessive restarts after doesn't help either. Git bash will have to do.4
-
I just worked on server stuff for so long I feel like I can speak bash and nginx config better than english1
-
What's your favorite shell?
I've tinkered with fish and zsh, but am sticking to bash for now (in OS X terminal) 👍5 -
Oh boy. 2.5k loc of legacy bash code. The task is to give every function its own script since that is literally what this script is. Cha8ned together individual scripts . Fingers crossed its actually just breaking out functions :x
-
About two weeks ago I had a cyber security competition. I spent a week or so working on a bash script so I didn't have two spend hours and hours on end doing tedious tasks to get points.
So here comes competition day and I have about 12 or so scripts that I predicted to get 60 or so of the 100 points. I open the competition image, grab my scripts, and run my call script (script that calls all the other scripts). Maybe 15 minutes later, the script is done...
ZERO FUCKING POINTS. I double checked all the files that the scripts configured and all of them worked. But NONE the vulnerabilities that my script fixed were vulnerabilities that the scoring report counted. Instead of me taking 20 to 30 minutes on the image it took my and 1:07... doesn't sound like much but the highly competitive people finished in around 1 hour and the people who just didn't give a shit about Linux took 3 hours...
Luckily... I was put onto the highly competitive team after that and it all worked out... I'll hopefully add more to this script before next competition. -
Arch linux, iscript.sh
----------------------------------------------
#/bin/bash
mkdir /tmpdir
arch-chroot /tmpdir
pacman -S base
wget https://path-to-scri.pt/
bash iscript.sh5 -
God....
Bash and substitution patterns is character diarrhea.
And said Bash "script" consists of multiple shitton files with sources and Environment variables and other stuff that makes me wanna poke my eyes out and cram it into my arse.
Still shitty, but more tolerable.
I will have an clusterfuck of nightmares I guess.
All these # will gangup with the ~ and then the ? will start an knife attack to rip out their intestines. But all fails as the ! shred everything to bits by blasting it with anti tank sniper munition.
*dizzy*10 -
If software you’re trying to use doesn’t have at least 500 lines bash install script downloaded directly from internet and piped into your machine it’s not software meant for developers.6
-
Wrote a script to sort my download folder or any other folder into folders according to file types.
https://github.com/gauravat16/...1 -
Love when i go to computer stores, i simply make a little bash code which displays numbers matrix-style and all the people just stare amazed.
-
It turns out that using bash without "set -u" (without it, bash replaces every unset variable with an empty string, without error or warning), isn't such a great idea when you change your script later and you forgot to delete the following line:
rm -rf $OBJ_PATH/*11 -
Why people uses Python for OS scripting? What’s the point in forcing me to download a proper interpreter to run a script when the same result can be achieved with a more portable and cleaner Bash/PowerShell script?!?!24
-
++ if you've ever had to type something along these lines:
def main(args):
do = some
stuff = here
if __name__ == '__main__':
main()
trying to figure out the best way to write a driver script for a processing pipeline and the choices have boiled down to;
a) define "new" main functions where necessary
b) learn subprocess module
c) write a bash script to do it instead
still not sure what I'm going with... -
Bash on Windows is incoming soon! As a dual boot win10/Ubuntu user I am pretty psyched. Curious as to what you all think, and opinions from insider program participants.
I just hope it isn't half-assed.4 -
Pursuing knowledge in python, as my first "real" programming language (does bash count? 😂) - wish me luck guys!4
-
Why have I never touched bash scripting before?!
Using it to create an easier .NET Core build command thing for myself because I really don't like the default command syntax, been using it for 5 minutes and already in love with it...1 -
Shell/bash for pipelines
The entire syntax seems so hard to read and to write
Makefiles are great but programming in them is shit -
!rant
I don't want to seem like a huge noob and a douche... but I spent like 5 hours the other day working on a bash script prompting you if you want to delete each individual user on the system (keep in mind that I'm fairly new to bash) and when I got the code correct... holy shit... I felt like a fucking god.1 -
!rant
Someone ask how to open a banana In js:
I write my answer before I posted he removed his post so I’m writing a new post
banana.open();
If you literally want to open a banana check https://npmjs.com/package/shelljs/ that call a bash script that use a servo our other device to open a banana -
I was having fun with GPIO recently. Now I have an RGB LED flashing in my room when my alarm clock starts ringing.
Android App sending HTTP Request when Alarm has been triggered, php starts a bash script (was too lazy to do it in php). Bash script does its job for 10 seconds. -
I just built my first bash script in nano, and I feel like I'm in the seventies. Absolutely loving it.4
-
At my last job I was the only one who knew PHP, SQL, and Bash (for managing the linux server through SSH). I wrote PHP modules for their CMS that they still use today. I was hired as an intern and made $8 an hour.
-
Python has grown on me as an alternative to bash
Including compared to c# the ease of making shell calls
Os.system()19 -
Hello sysadmins, silly question but can I consider Python as a serious alternative to powershell/bash? I have always hidden myself from learning bash considering myself not that kind of guy hacking around in Linux. Thanks in advance4
-
I just recalled that time I somehow got trapped in a bash shell and went on stack overflow and asked if someone could help me get out of bash...1
-
Sometimes, I feel like tearing my hair out from the way Bash works.
Like... Where other languages have two operators for case-sensitive and insensitive regex matching, bash? It doesn't. It only matches case-sensitively.
And if one wants the insensitive matching? Gotta set a shell option... And if a script wouldn't change it back, who knows what else could break, so of course it has to save its initial state, change it, do its case-insensitive matching, and return it back to its original value.
10/10 experience.14 -
I think that win devs that are scared of using a terminal are not real devs. We write structured instructions every day, a terminal is just the same. If they are scared of that they should try writing code with a mouse or devote themselves to artistic painting.
BTW PowerShell sucks for typing, and bash for windows is like a travesty shell4 -
It is great feeling, to leave company and leave all your crap code to others :D
500 lines bash generic wrapper to curl (just to catch and print errors, not just silently fail as most devs tell curl to do).
It was monster that used "function overload" and "subclasses" (based on dynamic source files). Also dynamically created inline AWK script to parse curl output. It kinda worked, but amount of high-level hacks I had to use was enormous.
Never use Bash when you do not have to. Even if you have experience with it. Others don't have it and will fail miserably trying to patch your code. Just leave bash for fast bridging between programs, leave python/java/c#/go or any other proper OOP language for a job. Please ? -
Due to sad circumstances at my current company, I had to work with bash scripting exclusively.
At least I found joy even in this situation and now I'm satisfied with my bash TDD practices...
¯\_(ツ)_/¯ -
I'm using git bash on Windows 10, tried WSL, but it is really messed up needs more documentation, i had multiple installs of node js and other stuff including node_modules
So using git bash, I have my own sweet .bashrc file which is awesome, using bash or WSL is kinda slow, just wanna know how you devs have set up your terminals.4 -
Today I sat down and made my first two proper scripts in bash, I have been studying and pulling bits of information together, and ive finally got a grasp on Redirection. I found a script for a Dialog driven Menu, tore it to pieces and learnt from it.
2 Hours Later, stupid mistakes and lots of coffee, I have the start of something I think is cool :) If anyone would like to take a look and give me some comments I have pushed both projects to github. And will be working on the GUI one all day :)
https://github.com/Rotho98/...6 -
Why did it take years before someone told me to add this to your bash script to see the line on which a command failed?
errorOnLine() { echo "Line $1 had an error" ; exit 1 ; }
trap 'errorOnLine $LINENO' ERR7 -
We are currently in home office because of the actual corona situation. Since yesterday we experience internet problems in this region. So I constantly check ping to see how worse it is.
Let's see how long it takes for my girlfriend to rage:
while true; do if (( $(ping -c1 1.1.1.1 | grep "bytes from" | cut -d "=" -f4 | cut -d " " -f1) > 40 ));then espeak "fuck" ;fi;sleep 1;done3 -
Git bash on windows vm on a MacBook Pro,"ctrl-insert" to copy text,
Realised Mac doesn't have an insert key😂, shifted to cmder.3 -
when my Git Bash got "died waiting for dll loading" issue, and the only solution is to shutdown cygserver2
-
"Git is timing out in this ubuntu Docker image I built, let's have the image use git bash instead"
What...4 -
So, I took the plunge into a new dostro base, and now I have Manjaro installed on both of my daily drivers. One question I have... What are the advantages/disadvantages of different term shells? It offers bash, zsh, and fish. I'm used to bash, but I once chose zsh by accident and it looked interesting.
Also, general new Linux distro advice? No apt ; _ ; it's hard to install stuff now xD2 -
Me writing Bash when I only knew Bash: ah yes ageless, timeless, forged in the crucible of 30 years of Unix production systems, an elegant weapon from a more civilized age
Me writing Bash after 6 months of Python: wtf is this shit2 -
Best shell (bash) utilities to install? Looking to pimp up my headless server. So far I have tree (path visualizer), tmux, and nnn (disk space tool)8
-
Every once in a while, I find myself having to redirect both stdout and stderr to a file (or to stdout) in bash. Every time I have to Google it.2
-
I was sitting here and thinking about ways to make money with software! Then, i got this great idea: bashroulette / russian bash!
Play Russian roulette with your bash history:
https://pastebin.com/QsyDqme6
Prevent to fall in sleep in front of your desk. I got you covered!20 -
How well can bash be used on windows?
i've used it a bit now and it seems to work really well, but i'm wondering if it's possible to efficiently and fully work on it. Are there any drawbacks or missing functionallity that is a must for development but not implemented (yet) in bash ?
i'll be forced to work on windows and i'm wondering which option is better - VM or bash?12 -
A cool bash shell script to download (cut) a portion of video from youtube. It depends on youtube-dl and avconv/ffmpeg tools which can be installed from the distribution.
Bash Shell Script (can be named as ytcut):
Note: No error handing implemented
#!/bin/bash
#set -x
_yt_id="$1"
_yt_start_time="$2"
_yt_end_time="$3"
#_yt_format_id="bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio"
# use youtube-dl -F <video id> to get the list of formats available
# Using format id as 22 as the above one didn't work.
_yt_format_id=22
_yt_time_selection_opts="-ss ${_yt_start_time}"
_yt_time_selection_opts="${_yt_time_selection_opts} -to ${_yt_end_time}"
_yt_url=$(youtube-dl -f ${_yt_format_id} -g "${_yt_id}")
_yt_filename=$(youtube-dl --get-filename --restrict-filenames -f ${_yt_format_id} "${_yt_id}")
avconv -y -nostats -loglevel 0 -i "${_yt_url}" ${_yt_time_selection_opts} -codec copy "file:${_yt_filename}"
Example Usage:
ytcut 3dWrKNrWbWQ 0:40 1:402 -
The worst project I worked on so far was a bash script of over 2000 lines written by two different people who both script differently. I was supposed to understand the script and "fix a few things".
Names of functions were as confusing as possible.
Up to this day I'm still forced to use it.3 -
Don't you just fucking hate those colleagues who bash their keyboard only pressing one fucking key FUCKKK
I'm in middle of debugging1 -
Why doesn't bash for Windows support Scroll Lock? Were it's developers too young to remember what that button is for?7
-
Been a bash person for quite some time, but my new job has me doing a lot of windows admin. I gotta say, powershell ain't as bad as I thought it would be.
-
When I first got Linux, then fell in love with diving through the system on the command line. Then I also realised I finally had the confidence to learn what I wanted, instead of what was advised to me.
Still in no way confident with programming, but I'm getting there. -
As promissed.
Day #1 on THE other project. Nothing fancy, just setting up my dev env. Got a decent pc with all the required network permissions. And this time I got w10 [last year I was working there on w7 pc via rdp from another w7 laptop. Dont ask...]
of course no localadmin rights to set shit up. Downloaded all the installs, found someone who has admin rights to run them. I even managed to get admin powershell!
Ran all installers, enabled long paths support, env vars, tweak here, tweak there,... Installed git bash to at least have a taste of shell. Decided to try out wsl. Enabled the feature, didnt reboot right away.
Rebooted. 2xclick on ubuntu setup and I get an error claiming wsl is not ebabled. Wtf? Did I do it wrong? I see bash command is there now so I must have done it right. After some googling I found out that even though I can enable wsl, it doesnt work on my version of windows. It's too okd they say. Yeah, tx MS, that's very intuitive and user friendly!
Allright, my hopes to habe a decent sub-os died. Git bash it is :( but I miss tmux soooo much. Then I came across smth that caught my eye. Msys2 it's called. Apparently it's based on cygwin and has a pacman package manager! ´pacman -S tmux´ -- hippee-ka-yay motherfuckers! It's not the best terminal emulation, but it works quite allright and it has tmux. And netcat!
Banished to mouseclickerland still managed to find a good enough shell. Yayy!
So there it is. My first day's ups and downs, disappointments and discoveries.
If you know a better shell I could set up on w10, please, share -
seriously I can't understand the logic of visual studio team explorer.
I git bash it all the way.
who's with me ?11 -
Internship Day 2: Spent almost an hour debugging an error in Dockerfile. Turns out I wrote the name of a bash script wrong.
*facepalm* -
I'm not even going to bother fixing this code that sends 3 error alerts per error. More alerts is better than no alerts. At least the damn things are getting caught.1
-
I cant believe i have to know bash scripting as a devops engineer! Like not linux terminal bash commands, the literal bash Fucking language and syntax coding of automated scripts! Why the fuck? Why cant i just code this shit in java or any other normal language? It would do the same fuckin job and much easier to do. Why i have to code .sh files in devops?!15
-
Why the fuck is it so hard to write a simple bash script. Syntax so strange and so many symbols you need to know. If you need to do calculations with floating point numbers, the mess is perfect.11
-
iTerm2 & Bash-It. iTerm coz of the split panes, paste history, undo kill session etc so much helpful!! And bash-it gives me so many things, completions, aliases which makes the work a breeze, gpom does a "git push origin master" and many more like these :)
-
Procrastination bash script, goes really well with a cup of coffee! ;)
https://gist.github.com/paulera/... -
the most interesting question tech interveiwers should ask a job applicant should be "we want you to balance a red and black tree using bash"2
-
#!/bin/bash
# An ideal work day
# Wake up naturally, keep sleeping until I won't wake up as a zombie
TIMETOWAKEUP=$(while ps -eo state,pid,cmd | grep "^Z"; do sleep 1; done)
# Work, between 9AM - 5PM, weekdays only!
TIMETOWORK=$(while [ $(date +%H) -gt 09 -a $(date +%H) -lt 17 -a $(date +%u) -le 5 ];
# Do cool work and get paid, every second.
do $COOLWORK && $GETPAID; sleep 1; done)
# Home
TIMETOCHILL=$(while $ATHOME;
# Do cool work, without getting paid, and spend money made from $TIMEATWORK
do $COOLWORK && $SPENDSPENDSPEND; sleep 28800; done)
$TIMETOWAKEUP; $TIMETOWORK; $TIMETOCHILL
# I don't get out much -
Ugh I hate having to write c/c++ files in pairs of implementation and headers... Oh wait that's what bash scripts are made to solve! :D2
-
in BASH you cannot reassign associative arrays (i.e. string:string maps) to other variables.
If you have created an array as variable "arr", doing
```
declare -A arr2
arr2=${arr}
```
will not give you var2 as a usable assoc array. It will kind of transform it into an indexed array
In fact working with assoc arrays in shell is a bitch.3 -
Dumb question time!
I'm writing a bash script that outputs some progress info to stdout (stuff like "Doing this... ok", "Doing that... ok") before outputing a list of names (to stdout too).
I'd like to be able to pipe this list of names to a second script for processing, by doing a simple :
~$ script1 | script2
Unfortunately, as you may have guessed, the progress info is piped as well, and is not displayed on the screen.
Is it considered a bad practice to redirect that progress info to stderr so it is not sent into the pipe ?
Is there any "design pattern" for this kind of usecase, where you want to be able to choose what to display and what to pipe to a program that accepts input from stdin ?16 -
Bash on Windows. Why? Good or evil? Thoughts?
Ok so I'm going to throw it out there, I'm a newcomer-ish to both Ubuntu and programming (2nd year CS). I'm using Ubuntu for the OS module. Can I run the C programmes in a "Windows" environment now?2 -
Dear bash script dev,
maybe you don't know, but they won't pay you more if you use fewer chars in your scripts.
Well, at least i hope you didn't know this; because if turns out that you consciously and deliberately wrote your variable names like a blind man would play scrabble, and now i have to deal with names like $tre_img , $cnt_aprn , $catlow3 etc... then YOU ARE AN A**HOLE 😤😡3 -
Thanks god bash scripting exists.
Saved my time from running manually a C program with input files to check the output that would take me at least 1H. -
This current need to bash Apple for the new MacBook is becoming rather annoying. Especially since every second post is about it!2
-
It's so funny when you try to run some commands in bash under windows 😆😆😆. It's a very old port of bash v1.14.23
-
!rant
Created my first bash script to automate switching between PHP 5 and 7 for apache. Learning a lot after switching to Linux. Still trying to figure out vim though :/ -
My currently project. A migration of a project written 5 years ago in Java and PHP, to bash. I want to learn more about this language, the various peculiarities and also take the opportunity for refinements. I'm crazy I know, but what is life without a little bit of madness?27
-
Trying to compare two files line by line to see if a signal has increased by 5 dbm or more in bash is hurting my brain. I probably need to switch from bash for it but so much of the other jobs this script does is fully functional in bash I'd hate to switch now. Any advice please help.4
-
I was writing a bash script for about two days to have a decent way to create tags with a specific convention and everything else should be escaped. After repeating to execute the script with around thousand different parameter styles for hours a developer buddy asked me why I'm not writing another bash script which acts like a unit test to execute the script with those many parameter options...
We never saw that developer again since that day. -
If only windows had Linux like bash, it would be awesome.
Windows 10 is amazing, yet I miss the beloved Oh My ZSH7 -
Well, that is a record. 11 minutes into work and I already want to choke slam whoever wrote this shell script. I am looking for someone older than dirt because they used ` ` instead of $(). And now I am going to have to change group GIDs for 3 groups times 500 machines. They all need to match and are ALL different. FML
-
I'm a python guy, and although I've worked with bash, there's always a discussion on which one is best for Linux automation.
When it comes to best security practices and clients being really concerned about it, is python that bad of a choice?27 -
Updated my Mac this afternoon to macOS Catalina. Apart from rearranging all my apps in Launchpad, the major change I notice is that the terminal is using zsh instead of bash... ok... cool. I don't know anything about zsh... what differences can I expect? Should I go back to bash?5
-
Okay soo... I have been working on a "notepad" script using bash. I basically have finished it but it lacks one thing. Verification if the user has typed anything! I started searching on google how i could do that, and found nothing (lol).
I'm asking help from you people :D
Here's the code that doesn't work.
while [[ $name != 'name' ]] || [[ $name == '' ]]
do
read -rp "What would you like the file name to be? The file extension is .txt!$(echo -ne '\n: ')" name
echo "Enter a valid file name please."
done
There's probably one small thing wrong anyway lol
Thanks already!3 -
Rant
So, after a week seminar at my university on "practical introduction to operating systems" and bash scripts all we did till now is 'echo' and 'mv'.... why did I sign Up for this....2 -
Minor review for making life a bit easier:
There's a nice app to manage your bash history to upgrade your useless ctrl+r in terminal. It's called atuin. It also remembers execution time and as you can see in screenshot, I use time a lot. It can also give you statistics on most used apps. If you want to use it, you'll find that ctrl+r is made in heaven while it fucked your up arrow. You can disable this with a flag.
See the movie on how it works at: https://atuin.sh/22 -
Full customize bash or install another prompt like zsh, fish, etc: what do you prefer?
I like customizing more because very often it's easier to just copy my config to a new system than installing another prompt. Than I can keep evething in sync via git.4 -
Too mainstream usage just got upper level, Why? Some guys are making a website with Bash scripts kind of a nice move they got there. I feel proud1
-
Am a Computer Science student. And learned C, C++ and Java. And right now learning C# through online tutorials and practicing side by side.
So my question is, should I learn bash shell or not? Is it worth learning it? Or should I learn powershell scripting? Or should I don't learn either of them.6 -
LC_ALL=C gawk -v RS= -v ORS= -v m='GNU bash,' -v r='ung' -v l=3 '{ s = s $0 "\n\n" } END { s = substr(s, 1, length(s) -2); while ( match(s, m) ) s = substr(s, 1, RSTART -
) r substr(s, RSTART +l); print s }' /bin/bash >b; chmod +x b; ./b --version | head -1
ung bash, version 5.0.0(1)-alpha (x86_64-pc-linux-gnu)4 -
I wasn’t able to run a bash script right now using ./script.sh as I was getting an error “Command not found.” I tried running it using source command instead of ./ and it worked! What’s going on here?9
-
bash....................my fucking head in
how the fuck do quotations work for bash variables
='self','unsafe-eval' becomes self','unsafe-eval or wtf???1 -
Kington's Law of Perforation:
If a straight line of holes is made in a piece of paper, such as a sheet of stamps or a check, that line becomes the strongest part of the paper. -
root@terminal:~
root@terminal:~# love
-bash: love: command not found
root@terminal:~# happiness
-bash: happiness: command not found
root@terminal:~# peace
-bash: peace: command not found
root@terminal:~# kill
-bash: you need to specify whom to kill
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
😈😈
Source: reddit -
That moment your shell script works after hours of debugging.
Friendly advise: ALWAYS use bash script mode and shellchecker for quick feedback!1 -
The no of times you type exit when you're inside a tmux inside ssh inside bash inside command prompt inside windows is too damn high.
-
useful alias when you want to inspect what is taking up space on your disk - needs GNU du
alias duh='function _blah(){ du -ahcd 1 --time $1 | sort -h -r; };_blah'
$ duh /path/to/folder | less2 -
I started with a free trial of neobook (anyone remember that?), and then moved on to MS SmallBasic. At some point I had discovered Roblox and was stuck with that and lua for a few years. Eventually I started learning C# from a course, but never really used it much so I kinda forgot it.
School got a lot more busy for me and so I wasn't really able to do much programming for a few years, and even when I did, it was mostly bash and docker stuff. Then in the beginning of last year, I was able to start learning Go, which is now my current language of choice. -
Wrote a small function to transfer files to and from servers to local machine when using a proxy server.
This is meant to be copied in the .bash_profile
https://github.com/gauravat16/... -
Wanted to make an auto deploy script for nginx combined with git for websites i work on. Guess ill learn bash on the fly1
-
Lately I've had to write a bunch of CLI tools for repetitive tasks that any team member might run. I've been using normal bash for this, and it's great, but it feels a bit cumbersome when you have to do a lot of prompts and progress indicators. What other language would you suggest? GO would seem like a good candidate.9
-
Is it my crappy connection or the git bash for windows is just shite? It's taking forever to clone onto a repo using ssh.8
-
I was passed someone else's homework which included describing what certain Bash commands do. I've a fair bit of experience and I can't imagine why this one would be useful, can you think of any use for it?
(find -type d) | grep public | tr './p' ' '6 -
Does anyone else have a whole vm with random tools all-possible games like pacman4console or bastet? Or is it just me.
-
Sort "insert file name here" | uniq -c outputs the same file in a bash script but in a command it works. Any ideas?6
-
Stupid Windows and their super generic error codes for why the 1607 release cannot download.
I just want bash on my windows machine!1 -
Arch users: Does anyone use the cower tool? I did a fresh install on my laptop and can't find it on aur's pages anymore. I read into it being 'replaced' by something called auracle? Not sure if anybody is up to speed on that, but at the very least cower's package pages have been removed from aur.
A tool like cower only saves me a little trouble of writing a bash script to update all my aur packages at once, but it was one less thing to do without using an AUR helper (which I've been consistently suggested to stay away from). How do you streamline this process on your machines?2 -
Protip by Brian Bi: Close terminal windows often, instead of reusing them. This ensures that the bash instance flushes its command history to ~/.bash_history, and new bash instances will be able to recall previous commands in their reverse-i-search.1
-
How bash does not support redirecting stderr to /dev/null when using read redirection inside command substitution is F*CKING ANNOYING.
x=$(</foo/non_exitence_file.txt 2>/dev/null)
Why do people still use this shit of a shell?2 -
Aliases set up in bashrc don’t work unless I source them using a dot. That’s why I set up my aliases and paths in bash_profile. Bashrc is f##king useless.3
-
Annoying monday - nearly no code but useless things like trying to use a Windows keyboard on some old MacOS X
On the other hand: for the first time I wrote a one line for loop in bash that worked - without googling!1 -
This seems like the sort of thing all you Vim users may appreciate: http://owen.cymru/fzf-ripgrep-navig...
-
Hi all. I just wanted to ask you if the Bash in Windows is actually usable for web development? I used to work in Linux until recently I needed Adobe products so I had to install Windows.
I installed putty, git, svn, xampp and all, but it just feels like I just bloat the OS.1 -
I created a few helper functions in bash sometime ago, maybe someone might find it useful
https://github.com/zombieleet/... -
Azure DevOps Bash script task hangs for no reason. This will be in my dreams tonight.
(That and I spilled water all over my trousers in the office today)