Skip to main content

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.

2votes
1answer
221views

Choosing test method of bash command output with bats

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
-1votes
2answers
90views

commonly used practices for deploying package primarily composed of bash scripts

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
-1votes
1answer
641views

Shell Script does not capture values inside ENDSSH

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
0votes
1answer
377views

If statement best practice [duplicate]

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
2votes
1answer
82views

How can I maintain bash functions without brittle escaped newlines?

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
2votes
3answers
2kviews

Is it pythonic to replace a bash script with series of subprocess calls

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
6votes
2answers
416views

Anything wrong with having aliases on a production server?

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
13votes
5answers
4kviews

How should I version control my bash profile?

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
23votes
2answers
17kviews

Share private SSH keys with Bash on Windows

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
0votes
1answer
375views

Pcregrep vs Perl vs Python for bash scripting when needing advanced regex features [closed]

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
2votes
2answers
2kviews

git clone vs cp -R

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
2votes
0answers
225views

Implementing redundant GIT backup scheme

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
2votes
2answers
132views

Ideas on processing input text file in parallel by Bash script

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
-1votes
2answers
335views

Extensible way to create bash program

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
5votes
4answers
1kviews

Shell commands in bash or python? How much encapsulation is too much?

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

153050per page
close