Search Results

Search: Posts Made By: etranman1
1,467
Posted By etranman1
Why are my text files sometimes empty when I make a read to them?
My implementation:

I have a script Caller.sh that runs in the background that continuously calls the following scripts:

createtext.sh
createtext2.sh
createtext3.sh

Each of these scripts...
6,149
Posted By etranman1
How to echo columns with consistent spacing?
for (.....)

echo -e "$Name | $Age | $Sex\t|$Grade\t\t"

done

output:


John |12 |Male |6th
Jack |15 |Male |8th
Zachary |15 ...
2,829
Posted By etranman1
Cool Thanks...One more question, is there a way...
Cool Thanks...One more question, is there a way to grep a line, then grep another line with only matches after the first grep?

for example:

john
max
amy
david
amy
john
zach

I want to...
2,829
Posted By etranman1
hmm, well I actually have spaces before firstname...
hmm, well I actually have spaces before firstname lastname and age...will that affect it?
2,829
Posted By etranman1
That doesn't seem to work
That doesn't seem to work
2,829
Posted By etranman1
Is there a way to grep the first occurence after a grep?
I have a text file:

firstname: John
lastname: Jay
age: 33

firstname: Amy
lastname: Jay
age: 12

firstname: Max
lastname: Jay
age: 50

Currently I have


first=`grep firstname...
12,879
Posted By etranman1
well what I want to do is continue processing the...
well what I want to do is continue processing the rest of the parameters instead of exiting the script...not sure how to do that
12,879
Posted By etranman1
no, it already does print an error message, but...
no, it already does print an error message, but it doesn't continue processing the rest of the arguments after the error...
12,879
Posted By etranman1
I don't want a -u. And also, i'd want to handle...
I don't want a -u. And also, i'd want to handle cases where the user might input a wrong parameter with an option...
12,879
Posted By etranman1
Bypass getopts errors and continue processing?
Is there a way to do this?

while getopts "n:g:m:i:p:d:a:" OPTION
do
case $OPTION in
...
if i do a ./script.sh -n john -u user -p password, it will output:


name= john
./script.sh:...
2,000
Posted By etranman1
I think the only one that worked was ...
I think the only one that worked was


hostname=$(echo ${hostname} | sed 's/^$/--/')
ip=$(echo ${ip} | sed 's/^$/--/')
netmask=$(echo ${netmask} | sed 's/^$/--/')

Thanks!
2,000
Posted By etranman1
that works, but if I use that in the for loop,...
that works, but if I use that in the for loop, there is an error..

for var in ${variables[@]}
do
$var=$(echo ${var} | sed 's/^$/ --/')
done
I can't do var= ... because that'll...
2,000
Posted By etranman1
How do I change a variable to something only if it's empty?
I feel like it is just a matter of using the $ operators correctly, but I can't seem to get it...



hostname="network"
ip="192.168.1.1"
netmask=""

variables=( $hostname $ip $netmask )
...
1,157
Posted By etranman1
How do I number my for loop outputs with this method?
Currently I am outputting users and I want to number them starting with 1...

grep name list.txt | awk -F"=" '{ print $2 }' | while read user; do
echo -e "1\t|$user"

Currently I have:...
Showing results 1 to 14 of 14

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