Search Results

Search: Posts Made By: philmetz
1,554
Posted By philmetz
But a new problem arose, how do i deal with...
But a new problem arose, how do i deal with numbers in Bourne Shell (sh)?

numFiles=ls $file | wc -l
echo "Number of files is $numFiles"

The above doesnt work, always displays 0 even though...
1,554
Posted By philmetz
ok found problem, it was displaying all the...
ok found problem, it was displaying all the contents of the directory, so i put a -d in the command
1,554
Posted By philmetz
Problem determining file
I got the following code, it partially works. Can someone tell me why it partially doenst work?

#!/bin/sh
file=$1

if [ `ls -l $file | cut -c1` = 'd' ]
then
echo "File is a directory"...
4,194
Posted By philmetz
so what is -a?
so what is -a?
4,194
Posted By philmetz
So for what you said the cut -c4 means select...
So for what you said the cut -c4 means select character 4 from the line abobe?
4,194
Posted By philmetz
I want to use this command: ls -l some_file ...
I want to use this command:
ls -l some_file

in my shell script

But I want to then determine if the file has execute permission for the file owner.

How could i do that?
Is there a way to...
4,194
Posted By philmetz
Shell nested ifs
Hi can someone tell me whats wrong with the following:


#!/bin/sh
file1=$1
file2=$2
if [ $# = 2 && -e $file1]
then
if [ -e $file1 ]
then
echo "File 1 is" $file1
...
Showing results 1 to 7 of 7

 
All times are GMT -4. The time now is 11:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy