Search Results

Search: Posts Made By: johnnybananas
2,089
Posted By drl
Hi. See also a package of date utilities,...
Hi.

See also a package of date utilities, among them dconv for conversion, as in this demonstration:
#!/usr/bin/env bash

# @(#) s1 Demonstrate date conversion of dates in file, dconv.
#...
2,089
Posted By zaxxon
Please use code tags for posting data, logs etc. ...
Please use code tags for posting data, logs etc.
Also post 2-3 example lines of your data please, so that we can easier avoid pitfalls and provide a better solution.

Blind shot:


$ cat infile...
8,737
Posted By sea
The -n checks if the following variable, in...
The -n checks if the following variable, in quotes, is Not-emtpy.

Since you grep a variable, you not only get the line you are looking for, but also the grep line itslf.
grep -v grep removes that...
8,737
Posted By sea
There is no need to save the output as a file. ...
There is no need to save the output as a file.
Have a look at:
PID=$(ps -l | grep -i "$1" | grep -v grep | awk '{print $4}')
if [ -n "$PID" ]
then echo "Do you want to kill $1 ($PID)?"
read -n1...
8,737
Posted By sea
Hello Allthough awk's first output column...
Hello

Allthough awk's first output column ($1) matches what you have passed $1, it is NOT the same.
One is a shell variable, and one is a column ID.

You can pass a variable to AWK, with awk -v...
3,368
Posted By neutronscott
find "${dir:-.}" -type f -perm u+r | wc -l ...
find "${dir:-.}" -type f -perm u+r | wc -l


See Bash Reference Manual: Shell Parameter Expansion (http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameter-Expansion).
3,368
Posted By Don Cragun
Try something more like: case $# in ...
Try something more like:
case $# in
(0) printf 'Enter directory: '
read dir;;
(1) dir="$1";;
esac
printf 'Using directory "%s"\n' "$dir"
Or, if, when no operands are given to your script, you...
3,368
Posted By RudiC
The user does not enter a parameter when typing...
The user does not enter a parameter when typing into a read statement. Parameters are supplied when calling the script (e.g.scname):
./scname A B C
= $0 $1 $2 $3
$#: 3
3,368
Posted By RudiC
Try read dir if [ -z $dir ] then dir="$PWD"...
Try read dir
if [ -z $dir ]
then dir="$PWD"
fi
Showing results 1 to 9 of 9

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