Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

Questions tagged [bash]

Bash is the shell from the GNU project. It is the standard shell on many Linux distributions and often available on other *NIXes.

Filter by
Sorted by
Tagged with
-2 votes
0 answers
80 views

I've just opened a relatively similar question (why nobody indents Bash?) on Stack Overflow. What I'm asking here is whether do you think the facts there is no type enforcing; there is no indentation ...
Scrooge McDuck's user avatar
2 votes
1 answer
244 views

Context While writing a bash script I would like to test every command I write. To do so I create a separate function per command that executes the function. In addition I want to log the output of ...
a.t.'s user avatar
  • 225
-1 votes
2 answers
110 views

I am working on a tool that primarily uses bash scripts and C++ code. Generally I have experience with basic tools written in C and C++ in which we can have a build system like ./configure; make; ...
Mihir Luthra's user avatar
-1 votes
1 answer
673 views

I am very new to writing Shell scripts and am trying to write a simple script to run Vagrant up then SSH into the box and run some commands. The echo Hi there will run but the read -p will never show. ...
Kevin's user avatar
  • 109
0 votes
1 answer
394 views

I am reviewing best practice with if statements. Below in example A I include the entire code to be run and ensure it remains within the if statement. While for example B the code to be executed ...
safesploit's user avatar
2 votes
1 answer
99 views

I have functions like this: foo() { /some/script \ --opt1=val1 \ --opt2=val2 \ --opt3=val3 } This is brittle if I take out the last option, or add any new option at any line. ...
djechlin's user avatar
  • 2,212
2 votes
3 answers
2k views

I have a pretty simple bash script which consists of a bunch of one liners and some simple logic. Its been recommended that I rip the bash script apart and rewrite it all in python using subprocess. ...
Roman's user avatar
  • 341
6 votes
2 answers
438 views

On my local server, I create aliases like these to speed up my work: alias bashrc='vi ~/.bashrc;source ~/.bashrc;echo bashrc has been sourced' alias bashprofile='vi ~/.bash_profile;source ~/....
Nav's user avatar
  • 1,191
13 votes
5 answers
4k views

So I'm very comfortable with version control, and just thought to start tracking versions of my bash profile: ~/.bash_profile with the added benefit of being able to share my various aliases and such ...
elliotwhitehead's user avatar
23 votes
2 answers
17k views

I have Windows 10 with Git installed. This Git uses my C:/Users/MyName dir as the HOME directory and the /.ssh/ dir within, appropriately for sourcing my private SSH keys. I have just enabled and ...
Toby's user avatar
  • 595
0 votes
1 answer
392 views

I've lately been using pcregrep to do Perl-style group matching when doing my bash scripts. The problem with pcregrep is that it's not readily available on Linux machines in general. An alternative ...
devoured elysium's user avatar
2 votes
2 answers
2k views

I want to use an existing project as a starting point for a new project by copying or cloning it. There are at least two ways of doing this. Method 1: Copy it. cp -R /path/to/source /path/to/dest ...
Mowzer's user avatar
  • 189
2 votes
0 answers
242 views

I want to push a local repo to multiple remote GIT repositories to achieve redundancy in my backup scheme. So, let's say I plan to use Github and BitBucket to host my repositories. I have two ...
Mowzer's user avatar
  • 189
2 votes
2 answers
162 views

I have a Bash script that processes files read from standard input, one pathname per line, and runs a CPU intensive task on each file. I happened to notice that even with four cores (grep -c ^...
pdp's user avatar
  • 131
-1 votes
2 answers
360 views

I have a bash script that should be extensible with additional functions with as little change to the script as possible. The basic function is as follows. It loops through a list of files to check. ...
Gerhard's user avatar
  • 15
5 votes
4 answers
1k views

I'm thinking about how to decide whether it's better to encapsulate my work behind well-named function names, or to expose it - which will help developers understand what's going on more quickly? Is ...
Robin Winslow's user avatar
2 votes
1 answer
2k views

I'm new to Docker and feeling my way around. My plan is to build a typical web app using Nginx+Rails+Postgress, all of which will be in the one container. I'm not (currently) doing anything complex ...
user avatar
0 votes
0 answers
1k views

I have a PHP page the sole purpose of which is to spawn a bash script to run some background code (10-15 seconds run time), and then forward to a second page. The second page waits for the background ...
user255406's user avatar
0 votes
1 answer
222 views

At home I use Linux and have for more than a decade. At work we use Windows and so I find PowerShell more familiar. I am a Linux/Unix fanboy at heart, but I've had greater success grokking the ...
M. Lanza's user avatar
  • 1,738
2 votes
1 answer
637 views

I have a moderately long(for me at least) bash script file that that maintains a list of LAN users and the bandwidth each one uses. It is 199 lines with 11 functions and is already calling 3 different ...
Randell's user avatar
  • 23
0 votes
1 answer
288 views

I am creating app(script) that is used similar to RSS reader for specific webpage that doesn't have RSS. So my app downloads that html page in defined intervals, checks new items and parses them into ...
HeliTux's user avatar
  • 119
14 votes
3 answers
692 views

Currently I have a command-line application in C called btcwatch. It has a -C option that it can receive as an argument that compares the current price of Bitcoin with a price that was stored ...
Marco Scannadinari's user avatar
3 votes
3 answers
2k views

I have been programming in BASH for a while now and the scripts that I write are starting to get more complicated. I realized that I started to bring in some habits from C/C++ and wanted to get ...
Dodzi Dzakuma's user avatar
1 vote
1 answer
8k views

I am writing some code in Python which checks for the validity of a license key after polling a server. If it is valid then the Python program in turn runs some bash scripts. How to create a ...
rahuL's user avatar
  • 119
6 votes
2 answers
1k views

Should bash be expected to change in ways that break non-trivial amounts of existing scripts at some point in the (near/<5y) future? How much change has it gone trough in the last ten years ...
user avatar
1 vote
2 answers
366 views

I am looking for feedback on the design of my program. I have a shell script call function.sh that defines a lot of helper functions. My intent is to use those bash functions defined in functions.sh ...
user80195's user avatar
11 votes
1 answer
11k views

Recently I was looking at python's shutil and subprocess etc... And I started wondering: wouldn't it be ok to use python instead of e.g. bash? What am I missing?
xtofl's user avatar
  • 344
1 vote
1 answer
427 views

As I have done multiple times before, I've written bash scripts, and just general commands that go nowhere. They just blink the little command line cursor at me for infinity until I control+C the ...
SecurityGate's user avatar
2 votes
1 answer
379 views

What is the best method to use and share variables between functions in non object-oriented program languages? Let's say that I use 10 parameters from DB, ID and 9 other values linked to it. I need to ...
srnka's user avatar
  • 355
1 vote
1 answer
2k views

I realise that this question may be down to personal preference but I'm pretty new to Bash / shell scripting so thought it'd be worth some research to see if there's some sort of standard/best ...
Bucky's user avatar
  • 185
13 votes
3 answers
4k views

I am writing a shell script with a few variables that should be configured by the user. There will be an installer for downloading and configuring the script, possibly by asking a series of question. ...
Charlie Rudenstål's user avatar
1 vote
1 answer
334 views

This is some sort of follow up to an older question of me. So I put the GPLv3 license into the project which contains my script and also added the copyright notice and copying permission statement to ...
Oliver Weiler's user avatar
7 votes
1 answer
3k views

I have written a bash script I would like to put under GPL v3. I've read the GNU documentation on How to Apply These Terms to Your New Programs and How to use GNU licenses for your own software. Still,...
Oliver Weiler's user avatar
4 votes
2 answers
413 views

In bash at least, if and case blocks are closed like this: if some-expr then echo "hello world" fi case $some-var in [1-5]) do-a-thing ;; *) do-another-thing esac as opposed to the ...
tomjakubowski's user avatar
10 votes
5 answers
6k views

I have FILE_A which has over 300,000 lines and FILE_B which has over 30 million lines. I created a Bash script that greps each line in FILE_A over in FILE_B and writes the result of the grep to a new ...
rogerio_marcio's user avatar
6 votes
6 answers
3k views

I have reasonable knowledge of PHP, Perl, and Bash. I use Perl for most text processing on my system (find, replace, filter output, etc). I use PHP for web development, allowing a user to view and ...
Alan Turing's user avatar
  • 1,533
11 votes
5 answers
5k views

I want to ask the user of my bash script to pass a directory path as argument. Which one of the following is a good programming practice? Require that the user enter a trailing / (forward slash) ...
Rohit Agarwal's user avatar
56 votes
16 answers
51k views

Other than being annoyed at whitespace as syntax, I'm not a hater, I just don't get the fascination with Python. I appreciate the poetry of Perl, and have programmed beautiful web services in bash &...