Top "Sh" questions

sh is the standard Unix shell since Version 7 Unix.

How to check if a string contains a substring in Bash

I have a string in Bash: string="My string" How can I test if it contains another string? if [ $string ?? …

string bash shell substring sh
How can I declare and use Boolean variables in a shell script?

I tried to declare a Boolean variable in a shell script using the following syntax: variable=$false variable=$true Is …

bash shell scripting boolean sh
How to do a logical OR operation in shell scripting

I am trying to do a simple condition check, but it doesn't seem to work. If $# is equal to 0 or …

bash unix if-statement sh
How to read a file into a variable in shell?

I want to read a file and save it in variable, but I need to keep the variable and not …

shell unix sh
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
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
How to run .sh on Windows Command Prompt?

How can I run .sh on Windows 7 Command Prompt? I always get this error when I try to run this …

windows bash command-line sh
'echo' without newline in a shell script

I have a problem with echo in my script: echo -n "Some string..." prints -n Some string... and moves to …

shell command-line sh
How do I run a shell script without using "sh" or "bash" commands?

I have a shell script which I want to run without using the "sh" or "bash" commands. For example: Instead …

bash shell alias sh
Difference between sh and bash

When writing shell programs, we often use /bin/sh and /bin/bash. I usually use bash, but I don't know …

bash shell unix sh