Improve
$vi multable.sh
echo "enter the value of n:"
read n
i=1
for((i=1;i<=10;i++))
do
echo " $n * $i = `expr $n \* $i`"
done
You don't need a shell script to do this; use the 'grep' command with the '-c' option to count the number of occurrences of some pattern.
use python, shell is stupid
You don't need a shell script for that; use either 'whoami' or 'id'
#!/bin/sh echo "6.0221415 * 10²³" #!/bin/sh echo "6.0221415 * 10 ^ 23"
seq 1 2 99
Well the question is not particularly specific. I assume that we are talking about shell and in this example I would refer to "bash" shell. #!/bin/bash echo $1 this simple script will print first parameter passed to it.
That would depend on what shell you're using. Most seem to have a command similar to "echo x" which will print x to the terminal.
#!/bin/sh wc -lw "$1"
You don't need a shell script to do this - just use the 'tail' command.
Use the builtin 'echo' or 'print' command followed by the shell variable name, which will substitute the value when printed/displayed.
cat FILE | awk 'gsub(/ /,"\n") gsub("\n","\n") {print}' | sort -ur
A shell function will do nothing unless it is explicitly called by other code, typically in a shell script. A shell script is a runnable, executable process, which can call other shell scripts and/or functions. The question might be worded backwards - it is necessary to write shell functions for shell scripts when certain logical functionality is required to be performed multiple times. Consider a shell function equivalent to a program subroutine - they operate the same way.