Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute Bash Shell Online

tutorialspoint.com

Execute Bash Shell Online

# Hello World Program in Bash Shel
echo "abc"> abc.txt
cat abc.txt

print_ip_range

cidr="192.168.0.1/24"

# range is bounded by network (-n) & broadcast (-b) addresses.
lo=$(ipcalc -n $cidr |cut -f2 -d=)
hi=$(ipcalc -b $cidr |cut -f2 -d=)

read a b c d <<< $(echo $lo |tr . ' ')
# echo $a.$b.$c.$d
read e f g h <<< $(echo $hi |tr . ' ')
# echo $e.$f.$g.$h


for ip in {$a..$e}.{$b..$f}.{$c..$g}.{$d..$h};
do
    echo $ip
done;

mmmmmmm

# Hello World Program in Bash Shell
mkdir Englishfootball
cd Englishfootball
mkdir EPL
mkdir Division1

teams=(Cardiff Fulham Newcastle Westham Tottenham ManchesterUnited ManchesterCity Watford Sothampton Bournemouth Brighton CrystalPalacer Chelsea Arsenal Huddersfield Everton Burnley Newcastle Liverpool Wanderers)

for team in ${teams[*]}
do
     printf 'This is a little description about %s\n' > $team

done

Execute Bash Shell Online

# Hello World Program in Bash Shell

echo "Hello World!" 

Execute Bash Shell Online

echo "System name"
read System
echo "System name is : $System"

Execute Bash Shell Online

#!/bin/bash
i=0

touch zzz
echo "a" >> zzz
echo "b" >> zzz
echo "c" >> zzz
echo "d" >> zzz

b=22

echo "$b" >> zzz




IFS='
' ttt=($(cat zzz))


while [ $i -le 4 ]
do
  echo ${ttt[$i]}
  let i=$i+1
done


echo ""
echo ""
echo "----------"
echo "   zzz    "
echo "----------"
echo ""
echo $(cat zzz)

what_happened

#!/bin/sh

# this is a comment

# let's give some values to variables
SOMETHINGELSE=TTT
DOGS=10
CATS=YELLOW

# if you uncomment the next line the "if" test will will be false
#CATS=ELLO

DOGS=1

echo "Let's do a loop"
for i in 1 2 3 4 5 100 200 112938 019283093 $SOMETHINGELSE $DOGS $CATS
do
  echo "Looping ... number $i"
done


if [ "$CATS" = "YELLOW" ]; then
  whatwesay="By the way, cats are yellow."
else
   whatwesay="what just happend?"
fi

# what do we say?
echo $whatwesay

# echo the "cal" command, defaults to current month
echo
cal

# -3 just prints out three months
echo `cal -3`

# make a blank line
echo

# let's loop through cal!
for x in `cal -3`
do
echo $x
done

what_just_happened

#!/bin/sh

SOMETHINGELSE=TTT
DOGS=10
CATS=YELLOW

echo "Let's do a loop"
for i in 1 2 3 4 5 100 200 112938 019283093 $SOMETHINGELSE $DOGS $CATS
do
  echo "Looping ... number $i"
done


if [ "$CATS" = "YELLOW" ]; then
  whatwesay="By the way, cats are yellow."
else
   whatwesay="what just happend?"
fi

echo $whatwesay

xxxxx

str="#"

for i in 1 2 3 4
do
   echo "$str"
   str="$str #"
done

Previous 1 ... 4 5 6 7 8 9 10 ... 101 Next
Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.