tagged [bash]

How do I launch a Git Bash window with particular working directory using a script?

How do I launch a Git Bash window with particular working directory using a script? How can I launch a new Git Bash window with a specified working directory using a script (either Bash or Windows bat...

16 Aug at 16:51

Getting an "ambiguous redirect" error

Getting an "ambiguous redirect" error The following line in my Bash script gives me this error: Why?

25 Jul at 18:30

Search for executable files using find command

Search for executable files using find command What type of parameter/flag can I use with the Unix `find` command so that I search executables?

20 Dec at 02:1

How to find the difference in days between two dates?

How to find the difference in days between two dates? A="2002-20-10" B="2003-22-11" How to find the difference in days between two dates?

11 Jul at 20:27

Running php script (php function) in linux bash

Running php script (php function) in linux bash How we run php script using Linux bash? php file `test.php` `test.php` contains:

1 Aug at 19:45

How to run a shell script on a Unix console or Mac terminal?

How to run a shell script on a Unix console or Mac terminal? I know it, forget it and relearn it again. Time to write it down.

11 Jan at 08:43

Difference between return and exit in Bash functions

Difference between return and exit in Bash functions What is the difference between the `return` and `exit` statement in Bash functions with respect to exit codes?

What does $@ mean in a shell script?

What does $@ mean in a shell script? What does a dollar sign followed by an at-sign (`@`) mean in a shell script? For example:

19 Aug at 07:19

uppercase first character in a variable with bash

uppercase first character in a variable with bash I want to uppercase just the first character in my string with bash. should print "Bar";

19 Sep at 15:33

Can I grep only the first n lines of a file?

Can I grep only the first n lines of a file? I have very long log files, is it possible to ask grep to only search the first 10 lines?

20 Mar at 05:14

bash : cd : too many arguments

bash : cd : too many arguments if i need to go to my directory named as"exception handling" then i write (cd exception handling) but it gives error too many arguments

10 Sep at 12:47

How do I check if a directory exists or not in a Bash shell script?

How do I check if a directory exists or not in a Bash shell script? What command checks if a directory exists or not within a Bash shell script?

27 Jan at 23:14

How to reload .bashrc settings without logging out and back in again?

How to reload .bashrc settings without logging out and back in again? If I make changes to `.bashrc`, how do I reload it without logging out and back in?

3 Jan at 22:4

How to get the contents of a webpage in a shell variable?

How to get the contents of a webpage in a shell variable? In Linux how can I fetch an URL and get its contents in a variable in shell script?

19 Sep at 14:2

Generating random number between 1 and 10 in Bash Shell Script

Generating random number between 1 and 10 in Bash Shell Script How would I generate an inclusive random number between 1 to 10 in Bash Shell Script? Would it be `$(RANDOM 1+10)`?

28 Apr at 08:34

What does "-ne" mean in bash?

What does "-ne" mean in bash? What does the command "-ne" mean in a bash script? For instance, what does the following line from a bash script do?

20 Mar at 03:21

How do I read user input into a variable in Bash?

How do I read user input into a variable in Bash? How do I read user input into a variable in Bash? ``` fullname="" # Now, read user input into the variable `fullname`. ```

19 Oct at 21:30

Associative arrays in shell scripts

Associative arrays in shell scripts We require a script that simulates associative arrays or map-like data structure for shell scripting. Can anyone let's know how it is done?

Bash foreach loop

Bash foreach loop I have an input (let's say a file). On each line there is a file name. How can I read this file and display the content for each one.

12 Nov at 08:43

How can I count the number of characters in a Bash variable

How can I count the number of characters in a Bash variable How can I count all characters in a bash variable? For instance, if I had the result should be

26 Feb at 06:14

Shell: How to call one shell script from another shell script?

Shell: 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`?

22 Oct at 12:51

Select random lines from a file

Select random lines from a file In a Bash script, I want to pick out N random lines from input file and output to another file. How can this be done?

11 Apr at 05:24

How can I debug a Bash script?

How can I debug a Bash script? Is there a way to debug a Bash script? E.g., something that prints a sort of an execution log, like "calling line 1", "calling line 2", etc.

25 Oct at 17:30

How to view files in binary from bash?

How to view files in binary from bash? I would like to view the contents of a file in the current directory, but in binary from the command line. How can I achieve this?

5 Dec at 22:36

What are the differences among grep, awk & sed?

What are the differences among grep, awk & sed? I am confused about the differences between `grep`, `awk` and `sed` in terms of their role in Unix/Linux system administration and text processing.

14 Jan at 09:45