Tag: sh

54 votes
28 answers
2.2K views
How do I list all of the files in a commit?

I am looking for a simple Git command that provides a nicely formatted list of all files that were part of the

avatar
Jesenia
0 1 0 9
asked 07 September, 2021
58 votes
30 answers
2.2K views
Stash only one file out of multiple files that have changed with Git?

How can I stash only one of multiple changed files on my branch?

avatar
Wilber
0 1 0 9
asked 07 September, 2021
59 votes
9 answers
547 views
Move existing, uncommitted work to a new branch in Git

I started some work on a new feature and after coding for a bit, I decided this feature should be on its own b

avatar
Chelsea
0 1 0 9
asked 07 September, 2021
57 votes
30 answers
957 views
Squash my last X commits together using Git

How can I squash my last X commits together into one commit using Git?

avatar
Tana
0 1 0 9
asked 07 September, 2021
58 votes
16 answers
375 views
How do I push a new local branch to a remote Git repository and track it too?

I want to be able to do the following: Create a local branch based on some other (remote or local) branch (via

avatar
Roger
0 1 0 9
asked 07 September, 2021
54 votes
30 answers
2K views
How do I delete a Git branch locally and remotely?

I want to delete a branch both locally and remotely. Failed Attempts to Delete a Remote Branch $ git branch -d

avatar
Corey
0 1 0 9
asked 07 September, 2021
67 votes
6 answers
1.3K views
Hash tables in MATLAB

Does MATLAB have any support for hash tables? Some background I am working on a problem in Matlab that requi

avatar
Patsy
0 1 0 9
asked 07 September, 2021
66 votes
7 answers
2.3K views
What's the difference between & and && in MATLAB?

What is the difference between the & and && logical operators in MATLAB?

avatar
Jefferey
0 1 0 9
asked 07 September, 2021
58 votes
30 answers
1.5K views
How do I test if a variable is a number in Bash?

I just can't figure out how do I make sure an argument passed to my script is a number or not. All I wan

avatar
Nidia
0 1 0 9
asked 07 September, 2021
56 votes
7 answers
2.9K views
When do we need curly braces around shell variables?

In shell scripts, when do we use {} when expanding variables? For example, I have seen the following: var=10

avatar
Jesenia
0 1 0 9
asked 07 September, 2021
56 votes
12 answers
848 views
How to 'grep' a continuous stream?

Is that possible to use grep on a continuous stream? What I mean is sort of a tail -f <file> command, b

avatar
Lorenzo
0 1 0 9
asked 07 September, 2021
54 votes
22 answers
3K views
Extract substring in Bash

Given a filename in the form someletters_12345_moreleters.ext, I want to extract the 5 digits and put them int

avatar
Wilber
0 1 0 9
asked 07 September, 2021
62 votes
22 answers
748 views
Use grep --exclude/--include syntax to not grep through certain files

I'm looking for the string foo= in text files in a directory tree. It's on a common Linux machine, I

avatar
Venice
0 1 0 9
asked 07 September, 2021
56 votes
10 answers
2.9K views
How do I pause my shell script for a second before continuing?

I have only found how to wait for user input. However, I only want to pause so that my while true doesn't

avatar
Benton
0 1 0 9
asked 07 September, 2021
59 votes
17 answers
2.7K views
Add line break to &apos;git commit -m&apos; from the command line

I am using Git from the command line and am trying to add a line break to the commit message (using git commit

avatar
Denese
0 1 0 9
asked 07 September, 2021
54 votes
16 answers
790 views
Count number of lines in a git repository

How would I count the total number of lines present in all the files in a git repository? git ls-files gives

avatar
Joseph
0 1 0 9
asked 07 September, 2021
57 votes
8 answers
1.9K views
What does set -e mean in a bash script?

I'm studying the content of this preinst file that the script executes before that package is unpacked fr

avatar
Lorenzo
0 1 0 9
asked 07 September, 2021
56 votes
18 answers
1.5K views
How to call one shell script from another shell script?

I have two shell scripts, a.sh and b.sh. How can I call b.sh from within the shell script a.sh?

avatar
Xavier
0 1 0 9
asked 07 September, 2021
66 votes
9 answers
3K views
Assigning default values to shell variables with a single command in bash

I have a whole bunch of tests on variables in a bash (3.00) shell script where if the variable is not set, the

avatar
Kurtis
0 1 0 9
asked 07 September, 2021
54 votes
28 answers
1.7K views
Shell command to tar directory excluding certain files/folders

Is there a simple shell command/script that supports excluding certain files/folders from being archived? I h

avatar
Hilario
0 1 0 9
asked 07 September, 2021