Sponsored Content
Full Discussion: Do i miss counter or what
Top Forums Shell Programming and Scripting Do i miss counter or what Post 302902985 by Akshay Hegde on Friday 23rd of May 2014 10:25:02 AM
Old 05-23-2014
Quote:
Originally Posted by nimafire
hello
this script should show all users and space they used without problem :

Code:
ls /home >> /root/users.txt
cat /root/users.txt | while read line; do
space=`du -s /home/$line`
echo "$line space is $space"
shift
done

but when i remove pipe ,script run without any output:

Code:
ls /home >> /root/users.txt
mama=`cat /root/users.txt`
while read $mama; do
space=`du -s /home/$mama`
echo "$mama space is $space"
done

try this way you will come to know, in second code you are reading nothing so no o/p

Code:
while read line; do
     echo $line
done < "Your_Input_File"

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

During deleting just miss some folders

There is directory test: > ls -rtl total 12 drwxr-xr-x 2 root sys 4096 Aug 17 09:57 test2 -rw-r--r-- 1 user1 group1 16 Aug 17 10:00 test -rw-r--r-- 1 user1 group1 16 Aug 17 10:00 test1 -rw-r--r-- 1 user1 group1 16 Aug 17 10:01 test12 -rw-r--r-- 1 user1 group1 16 Aug 17 10:01 test13 ... (5 Replies)
Discussion started by: user_junior
5 Replies

2. Solaris

Fast Data Access MMU Miss

Hi All , I am unable to reinstall the OS on my Ultra Sparc 10. After the 1st CD is loaded when it goes for reboot its goes to ok prompt an its unable to boot. What could be reason for this behavior? while loading the OS its seems fine but unable to boot!! Then i tried changing the... (2 Replies)
Discussion started by: kumarmani
2 Replies

3. UNIX for Dummies Questions & Answers

Use pipes but miss a action

please delete and see other post. Hi, Im using awk to go through every line, but i have to use it twice as the first awk finds all the lines with a number in one field and the pipes it to wc, and the second does the same as the first but it has a extra pipe into sort and uniq that finds all... (2 Replies)
Discussion started by: fredted40x
2 Replies

4. AIX

Miss filesets

Hello everyone I updated a partition from TL06 to TL09, everything looks ok. I check the errpt comand, lppchk -v and both are fine. But when I type this command I got this $ instfix -i |grep ML All filesets for 5300-02_AIX_ML were found. All filesets for 5.3.0.0_AIX_ML were... (3 Replies)
Discussion started by: lo-lp-kl
3 Replies

5. Shell Programming and Scripting

counter

Hi, I need some help. Shell script counter. i need to add condition to check if counter is more than 10 and longer than 3 hours? it runs every 5 mins. it only check count and send email right now. it runs in cron as below gregcount.ksh gregdb 10 > /tmp/gregcount.out 2> /tmp/gregcount.err ... (1 Reply)
Discussion started by: pega
1 Replies

6. Ubuntu

fast data access mmu miss

hello, before i have install solaris 9, is good. I would like to install Ubuntu 10.04 on a Sun Blade 150 blade. I create cdrom iso burning with a 10x was open I made a boot ok: boot cdrom I get the following error: fast data access mmu miss i do probe-ide all reset-all always ... (2 Replies)
Discussion started by: philo_71
2 Replies

7. Shell Programming and Scripting

Perl's buffered I/O is causing me to miss latest log file entries in log colorizer. How to fix?

I've been finding myself using a log file colorizer written in perl to reformat and colorize the output from many different programs. Mainly, however, I use it to make the output from "tail -f" commands more readable. The base perl script I use is based on "colorlogs.pl" available from the... (1 Reply)
Discussion started by: rcsteiner
1 Replies

8. Shell Programming and Scripting

Counter

if ;then echo "mrnet greater 5000" gzip /var/log/mrnet.log mv /var/log/mrnet.log.gz /var/log/mrnet.log.1.gz if ];then i=1 let i++ mv /var/log/mrnet.log.1.gz /var/log/vieux-logs/mrnet.log.$i.gz else echo "theres no... (1 Reply)
Discussion started by: Froob
1 Replies

9. Solaris

Solaris 10 boot problem - ERROR: Last Trap: Fast Data Access MMU Miss

Hello, We have a T5140 server with Solaris 10 and its suddenly throwing "segmentation core" when I login into the server and not showing any output for commands like df, mount etc. so I had to reboot the server to fix this issue. Please note that there's no boot disk mirroring. But... (2 Replies)
Discussion started by: prvnrk
2 Replies
COLORS(3)						   libbash colors Library Manual						 COLORS(3)

NAME
colors -- libbash library for setting tty colors. SYNOPSIS
colorSet <color> colorReset colorPrint [<indent>] <color> <text> colorPrintN [<indent>] <color> <text> DESCRIPTION
General colors is a collection of functions that make it very easy to put colored text on tty. The function list: colorSet Sets the color of the prints to the tty to COLOR colorReset Resets current tty color back to normal colorPrint Prints TEXT in the color COLOR indented by INDENT (without adding a newline) colorPrintN The same as colorPrint, but trailing newline is added Detailed interface description follows. Available colors: Green Red Yellow White The color parameter is non-case-sensitive (i.e. RED, red, ReD, and all the other forms are valid and are the same as Red). FUNCTIONS DESCRIPTIONS
colorSet <color> Sets the current printing color to color. colorReset Resets current tty color back to normal. colorPrint [<indent>] <color> Prints text using the color color indented by indent (without adding a newline). Parameters: <indent> The column to move to before start printing. This parameter is optional. If ommitted - start output from current cursor position. <color> The color to use. <color> The text to print. colorPrintN [<indent>] <color> The same as colorPrint, except a trailing newline is added. EXAMPLES
Printing a green 'Hello World' with a newline: Using colorSet: $ colorSet green $ echo 'Hello World' $ colorReset Using colorPrint: $ colorPrint 'Hello World'; echo Using colorPrintN: $ colorPrintN 'Hello World' AUTHORS
Hai Zaar <haizaar@haizaar.com> Gil Ran <gil@ran4.net> SEE ALSO
ldbash(1), libbash(1) Linux Epoch Linux
All times are GMT -4. The time now is 11:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy