Top "Shell" questions

The term 'shell' refers to a general class of text-based interactive command interpreters most often associated with the Unix & Linux operating systems.

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.

linux bash macos shell unix
How to represent multiple conditions in a shell if statement?

I want to represent multiple conditions like this: if [ ( $g -eq 1 -a "$c" = "123" ) -o ( $g -eq 2 -a "$c" = "456" ) ] then echo …

bash shell unix
Shell script "for" loop syntax

I have gotten the following to work: for i in {2..10} do echo "output: $i" done It produces a bunch of …

unix syntax shell
How to reload .bash_profile from the command line?

How can I reload .bash_profile from the command line? I can get the shell to recognize changes to .bash_…

bash shell command-line
How can I count all the lines of code in a directory recursively?

We've got a PHP application and want to count all the lines of code under a specific directory and its …

bash shell
How to echo shell commands as they are executed

In a shell script, how do I echo all shell commands called and expand any variable names? For example, given …

bash shell sh posix trace
How to run a PowerShell script from a batch file

I am trying to run this script in PowerShell. I have saved the below script as ps.ps1 on my …

windows shell powershell batch-file
Ubuntu says "bash: ./program Permission denied"

I am running Ubuntu on computer 1 and computer 2. I compiled a C++ program on computer 1, and I can execute it …

bash shell sh
Using wget to recursively fetch a directory with arbitrary files in it

I have a web directory where I store some config files. I'd like to use wget to pull those files …

shell wget