Posts Tagged ‘shell script’

What shell script command will allow the user to log out via script?

I’ve made a Fedora Core 2 shell script in which the user is prompted for different things he or she would like to do.

I’d like to make another selection in which the user can choose the number 3 and then the user logs out of the OS! I’ve tried logout and exit but they don’t seem to work in the script.

Any ideas? thanks.

linux shell script: how do i check home directory size and email user if its too big?

I am trying to write a shell script that evaluates the size of each user’s home directory and if it is greater than 50 MB I want an email to be sent to their user account telling them that they need to reduce the size of their home directory.

I am mainly having trouble with using the output of du -s /home/* to compare each size to 50mb and then sending an email to that user, any help would be fantastic thank you.

How to count duplicate the lines of a file by using Linux Shell Programming?

Hi,

I’m new to linux and to shell programming. I have an assignment to create a shell script that shows all the folders, sub folders and files of the current directory. LS does this. But I must count how many duplicate lines each file has, and show the line that is repeated the most times in each file.

I really have no idea where to start. How can I read/compare lines within a file?

Thanks in advance!

How to write shell script that saves output of (ls -ltr) in a file?

Shell script to save the output of ‘ls -ltr’ every five minutes and after every hour it should print which all files are changed/modified/created.

How do I write a script for my Linux that can show me total memory vs used memory and have it email me results?

I want to create a shell script for this but I am having a hard time figuring out commands and completing the script.

How do I write a statement in dos using shell script to display a word?

I want to write a shell script in dos to display the word "Hello"

Difference between GNU Makefile & Shell Script?

Hi, I want to know what couldn’t be done with a shell script that is possible with a Makefile. What is the major difference between a shell script and a Makefile? Your suggestions please.

How can I make my script check if an entered subdirectory is valid?

I’m writing a shell script for class that needs to prompt the user to enter a subdirectory, If their entry is valid, it will display the contents of that directory. If it is invalid, it will throw an error message and exit.

How can I make the script check if their entry is valid without having to program each and every directory into the script?