Q.) cat actors.txt
print the file with its line count as shown below :
1 : Tom Hanks
2 : Leonardo DiCaprio ....likewise
Q.) Write a Bash script that takes a single character as input from the user. The script should determine whether the input character is a vowel or a consonant. Adjust for both lowercase and uppercase condition.
Q.) As a system administrator, you need to script a way to quickly gather and display essential server metrics for routine monitoring. This information is crucial for assessing server health and performance. Include the metrics like Date, Uptime, Memory Usage, Network interface along with IPs, CPU only report with 2 seconds interval and 2 times, top 5 processes by memory usage.
Bonus Q.) Write a Bash script that continuously displays a countdown starting from 0, incrementing by 1 in each iteration. The script should run indefinitely until manually terminated.
Level L1 and above
I'll be posting a series of Linux-related questions covering various skill levels. Feel free to share your insights and expertise. Your contributions will benefit learners at all stages, from those in current roles to those preparing for Linux interviews.
@Trevor This works like a charm !! great job and it is easily understandable for beginners as well!
Bonus Q.) Write a Bash script that continuously displays a countdown starting from 0, incrementing by 1 in each iteration. The script should run indefinitely until manually terminated.
Observation: If the script is going to be counting down, shouldn't it be decrementing instead of incrementing
Solution:
=================================
# This script will run until the cows come home, the electricity is turned off,
# or which ever comes first - unless there is manual intervention on the
# part of the user to terminate it!
val=0
while [ true ]
do
echo The value of val is $val
val=$((val+1))
sleep 1
done
=====================================
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.