1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #!/bin/bash # Shell script to find the number of files present in the current # directory without using WC command. # NOTE/TIP: # If allowed to use WC command then it should be as follows: # ls | wc -l # ------------------------------------------------------------------------- # Copyright (c) 2005 nixCraft project # This script is licensed under GNU GPL version 2.0 or above # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ------------------------------------------------------------------------- FILE="/tmp/count.txt" echo -n "Enter directory name : " read dname ls $dname > $FILE echo "No of files in directory : $(grep [^*$] $FILE -c)" rm -f $FILE |
Shell Script To Display The Text Entered By The User in Bold
in Categories Academic last updated April 15, 2008Write a shell script to display the text entered by the user in bold?
You need to use the tput utility to display text in bold. It uses the terminfo database to make the values of terminal-dependent capabilities and information available to the shell, to initialize or reset the terminal, or return the long name of the requested terminal type. tput bold turns on bold (extra bright) mode.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #!/bin/bash # Script to display the text entered by the user in bold # ------------------------------------------------------------------------- # Copyright (c) 2005 nixCraft project <http:> # This script is licensed under GNU GPL version 2.0 or above # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ---------------------------------------------------------------------- # read man page of tput command. echo -n "Enter text : " read text echo "Here is what you entered " # use tput command to display it in bold tput bold echo "$text" echo -n "Press any key to continue..." # okay turn of bold effect read key # it will clear screen too tput reset |
AWK Array Script To Find File Maximum, Minimum and Total File Sizes
in Categories File-management last updated July 26, 2009A Sample AWK and shell script to list total file size, minimum, maximum and other size using Arrays
FreeBSD ipfw Traffic Shaping Firewall Script
in Categories Firewall, Networking, Security last updated September 27, 2013FreeBSD IPFW example firewall script to shape traffic for your LAN and WAN network.