I am some new to the programming world but starting to get hang of it.
My question is,what shell should I use bash or sh (Ubuntu uses dash for sh)
Is the one faster, users more memory etc?
Example scripts
Code:
#1
for I in {1..10}; do echo $I; done
#2
for I in 1 2 3 4 5 6 7 8 9 10; do echo $I; done
#3
for I in $(seq 1 10); do echo $I; done
#4
for ((I=1; I <= 10 ; I++)
going through advanced bash scripting guide example 3.3 running a loop in background, i found this :
#!/bin/bash
# background-loop.sh
for i in 1 2 3 4 5 6 7 8 9 10 # First loop.
do
echo -n "$i "
done & # Run this loop in background.
# Will sometimes execute after second loop.
echo # This 'echo' sometimes will not display.
for i in 11 12 13 14 15 16 17 18 19 20 # Second loop.
do
echo -n "$i "
I am trying to determine the location of bash interpreter on my Solaris system and I am a bit confused. When I type:
echo $SHELL
The resulting path is:
/bin/bash
And when I type:
which bash
I get:
/usr/bin/bash
Can anyone please explain this discrepancy?
Upon opening Terminal I get the following message:
Code:
-bash: /usr/bin/manpath: No such file or directory
-bash: /usr/bin/perl: No such file or directory
-bash: grep: command not found
-bash: grep: command not found
-bash: grep: command not found
-bash: grep: command not found
I searched other threads for similar problems and I think I have a $PATH issue
I enter
Code:
echo $PATH
I'm trying to write a bash script to install PostgreSQL server on a Debian 6 VPS.
I am specifying path to my command in the file /etc/profile:
export PATH=$PATH:/usr/app/cpn/bin
My command is located in:
$ which ydisplay
/usr/app/cpn/bin/ydisplay
So, when I performing "echo $PATH" output is looks like:
$ echo $PATH
...:/usr/app/cpn/bin
And everything is OK, but when I am trying to launch my command via SSH I am getting error:
$ ssh 127.0.0.1 ydisplay
$ bash: ydispla
This question is a sequel of sorts to my earlier question. The users on this site kindly helped me determine how to write a bash for loop that iterates over string values. For example, suppose that a loop control variable fname iterates over the strings "a.txt" "b.txt" "c.txt". I would like to echo "yes!" when fname has the value "a.txt" or "c.txt", and echo "no!" otherwise.
I have a script on a server-A
Script-A
#!/bin/bash -l
echo "script-A.sh" | change-environment.sh
When I ssh onto server-A and execute it, it works fine.
However, when I
ssh user@server-A ./script-A.sh
Script-A executes, but throws an undefined variable error in change-environment.sh.
Guys,
when i am executing the following script I am getting following error.
Code:
-bash: test.sh: command not found
Code:
$ test.sh -- script name
#!