#!/bin/sh
[ -s $1 ] && echo "not empty" [ -f $1 ] && echo "empty" echo "not a file"
[ $UID -ne 0] # Checks if the user ID is not 0 (root UID)
You don't need a shell script for that; use either 'whoami' or 'id'
You haven't specified what the 'name' is, so it is not possible to answer the question.
You don't need a shell script to do this - just use the 'tail' command.
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.
write ashell script to add awo matrix using array.
#!/bin/sh PS -a
We can not perform Shell Scripting in DOS, we can do Batch programing in DOS..
shell script for check whether the given no is prime or not??echo "input any number:"read nono=`expr $no`i=`expr 2`while [ $i -lt $no ]doif [ `expr $no % $i` -eq 0];thenecho "$no is not a prime no.."break 2fii=`expr $i +1`doneif [ $i -eq $no ];thenecho "$no is a PRIME no..."fi
If the shell script is readable and executable then to execute it just type the name of the shell script file. Otherwise, you can explicity call a shell interpreter to run the file as a shell script, i.e., ksh myfile
You don't need a shell script to do that. Since you don't say what 10 shell variables you want, you can list them all by using the 'set' command to list all known in-use shell variables in the current session.
use python, shell is stupid