I started using Debian system from a week ago, a lot of things are new to me. The text-based terminal seems a bit tedious at first (from a Windows user), but little-by-little I'm starting to get used to some basic commands that allow me to get simple things done. For the first time in my life, I feel like I'm in control of my computer.
Then I read about shell script and how powerful it could be. I was instantly attracted by its potentials and began learning it through http://www.freeos.com/guides/lsst/. However, the progress isn't very fast as I wanted to be.
Something is bugging me while I'm trying to follow a shell script tutorial.
e.g. with the following script (name: pos_neg)
Code: Select all
#!/bin/sh
#
# Script to see whether argument is positive of negatvie
#
if [ $# -eq 0 ]
then
echo "$0: You must supply one integer."
exit 1
fi
if [ $1 -gt 0 ]
then
echo "$1 is positive."
else
echo "$1 is negative."
fi
Code: Select all
$sh pos_neg 3
2. Why can't I execute the script with
Code: Select all
$./pos_neg 3
Code: Select all
sudo: unable to execute ./pos_neg: Permission denied
Code: Select all
if [ $# -eq 0 ]
Code: Select all
if [ $# == 0 ]
Thank you for your precious time.
Arktos