LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-16-2021, 04:27 AM   #1
iamin
LQ Newbie
 
Registered: Mar 2021
Posts: 2

Rep: Reputation: Disabled
Shell script menu option


I need to create a script with different menu options one of them is to have an option to create a file that contains

The file should be date stamped and saved to a directory.



Thank you for all the help!

Last edited by iamin; 03-16-2021 at 12:20 PM.
 
Old 03-16-2021, 04:53 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,901

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
Hi, and welcome here, at LQ!

Is this your homework?

I would try something like this: https://askubuntu.com/questions/1705...a-shell-script
 
1 members found this post helpful.
Old 03-16-2021, 04:59 AM   #3
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Quote:
Originally Posted by iamin View Post
4)running processors ps -aux
Not quite. It's either ps aux (BSD style, note the lack of dash) or ps -ef (System V style).
Quote:
Originally Posted by iamin View Post
5) to create a file is touch.
Probably non needed in this case. Just redirect the output of each command to a file with >>.

Last edited by shruggy; 03-16-2021 at 05:05 AM.
 
1 members found this post helpful.
Old 03-16-2021, 05:09 AM   #4
iamin
LQ Newbie
 
Registered: Mar 2021
Posts: 2

Original Poster
Rep: Reputation: Disabled
I have already created a menu option for mu script but i have to add another option to create a file and i'm not sure how to put it together to make the option work. What's the best way to do this?
 
Old 03-17-2021, 04:07 AM   #5
Honest Abe
Member
 
Registered: May 2018
Distribution: CentOS 7, OpenSUSE 15
Posts: 420
Blog Entries: 1

Rep: Reputation: 202Reputation: 202Reputation: 202
Quote:
Originally Posted by iamin View Post
I have already created a menu option for mu script but i have to add another option to create a file and i'm not sure how to put it together to make the option work. What's the best way to do this?
We really need to see some code snippets to see what exactly you want.
 
2 members found this post helpful.
Old 03-17-2021, 11:25 AM   #6
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Your script will need to ask for the file name and the directory name (or full path) as well as using the date command to put the date (date stamping) into the file.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash script menu with sub menu sbrock Programming 6 03-10-2024 03:59 PM
Shell script with Menu and sub menu and in sub menu execute another shell script SHWE Linux - Newbie 9 11-03-2018 06:19 PM
Zenity Shell Menu for 50+ servers, How to stay in server menu ? Navdeep.D2 Linux - Newbie 1 05-08-2017 08:41 PM
Menu bashed shell script for users shell 0.o Linux - Server 6 02-14-2013 06:00 AM
How to prevent "leak" into Shell from a customized shell menu script dctw Programming 11 12-28-2009 04:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration