Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a problem:need to bild a bash script who shows the history of shell commands,analize them and delete all commands that aren't in /bin and show the new list.if in the first list there are no commands that are in /bin show appopriate message .
I have a solucion: for hist in $(history | grep -v "/bin" | awk '{print $1}'); do history -d ${hist}; done
can someone tell me if it's right and how to show an apopriate message? thank you
I have a problem:need to bild a bash script who shows the history of shell commands,analize them and delete all commands that aren't in /bin and show the new list.if in the first list there are no commands that are in /bin show appopriate message .
I have a solucion: for hist in $(history | grep -v "/bin" | awk '{print $1}'); do history -d ${hist}; done
can someone tell me if it's right and how to show an apopriate message? thank you
Better than someone telling you, is you actually running it, and seeing if it does what you'd like. If you executed that on your system, you'd have had your answer in less time than it took you to post.
If you're new to shell scripting, there are many tutorials (see the link in my posting signature), which can help you with loops/conditions and printing messages.
Better than someone telling you, is you actually running it, and seeing if it does what you'd like. If you executed that on your system, you'd have had your answer in less time than it took you to post.
If you're new to shell scripting, there are many tutorials (see the link in my posting signature), which can help you with loops/conditions and printing messages.
oh you are a genius thank you!I have never thought about running it!I wrote all that to see if someone have a better solution or idea,you aren't abligated to help,better if you don't write nothing
oh you are a genius thank you!I have never thought about running it!I wrote all that to see if someone have a better solution or idea,you aren't abligated to help,better if you don't write nothing
And it would be better if you actually wrote something on your own...you haven't shown ANY effort, and the one command you did post here was written by someone else.
We are always happy to HELP, but we aren't going to do your homework for you. YOU have to show some effort of your own..post what YOU have written/tried and where you're stuck. And its against the LQ Rules to double post a question...stick with your other thread.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.