answersLogoWhite

0

#!/bin/sh

[ -s $1 ] && echo "not empty" [ -f $1 ] && echo "empty" echo "not a file"

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Write a shell script to check if you are root or not?

[ $UID -ne 0] # Checks if the user ID is not 0 (root UID)


Write a shell script to show that user is logged in or not?

You don't need a shell script for that; use either 'whoami' or 'id'


Write a shell script where you check whether the name begins with A and ends with t?

You haven't specified what the 'name' is, so it is not possible to answer the question.


How do you write a shell script which counts the last 10 lines present in a given file?

You don't need a shell script to do this - just use the 'tail' command.


When might it be necessary or advisable to write a shell script instead of a shell function?

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.


How do you add two matrices using Linux shell script?

write ashell script to add awo matrix using array.


How do you write a shell script to enlist the processes being run?

#!/bin/sh PS -a


How do you write a statement in DOS using shell script to display a word?

We can not perform Shell Scripting in DOS, we can do Batch programing in DOS..


Write a shell script to check whether the given input is prime or not?

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


What is the command to execute a shell script?

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


How do you write a script which lists the 10 Shell System variables?

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.


Write a shell script that counts a number of unique word contained in the alphabetical order line by line?

use python, shell is stupid