Can anyone help to create such menu? [closed]











up vote
0
down vote

favorite












The script should offer a menu with the following options:



● To create a backup copy of a script file.




  • The name of the backup copy should have backup after the name of the script and be date stamped e.g. Ass3Script_backup_10_11_2015.

  • It should be saved to your home directory using the Environment Variable for your home directory.

  • The script should error check that the file exists and is a normal file. If this is not the case then the script should allow the user to re-enter the filename until a valid filename is entered


● To create a date stamped log file called e.g. log_file_10_11_2015 containing:




  • A list of who is logged into the system,

  • The disk usage and

  • Your currently running processes.

  • The file should be saved to an existing directory called log_dir which should be situated off your home directory


● To create a copy of a file.




  • The file should be in your current directory (the name of the file to be given by the user)

  • The destination directory name to be given by the user.

  • The script should error check that the file exists and is a normal file. If this is not the case then the script should allow the user to re-enter the filename until a valid filename is entered.

  • The script should check that the destination directory exists. If this is not the case then the script should allow the user to re-enter the destination directory until a valid directory is entered.


● To move the location of a file in your current directory (the name and destination to be given by the user)




  • The script should error check that the file exists and is a normal file. If this is not the case then the script should allow the user to re-enter the filename until a valid filename is entered.

  • The script should check that the destination directory exists. If this is not the case then the script should allow the user to re-enter the destination directory until a valid directory is entered.


● This script should loop continuously until the user chooses to quit.










share|improve this question















closed as too broad by Kevin Bowen, guntbert, Zanna, Charles Green, Eric Carvalho Dec 8 at 12:23


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 9




    This reads like a homework assignment. Is this such an assignment?
    – user535733
    Nov 30 at 0:34








  • 4




    The basic structure you want is covered in How can I create a select menu in a shell script? - the rest of your question is too broad IMHO
    – steeldriver
    Nov 30 at 1:05















up vote
0
down vote

favorite












The script should offer a menu with the following options:



● To create a backup copy of a script file.




  • The name of the backup copy should have backup after the name of the script and be date stamped e.g. Ass3Script_backup_10_11_2015.

  • It should be saved to your home directory using the Environment Variable for your home directory.

  • The script should error check that the file exists and is a normal file. If this is not the case then the script should allow the user to re-enter the filename until a valid filename is entered


● To create a date stamped log file called e.g. log_file_10_11_2015 containing:




  • A list of who is logged into the system,

  • The disk usage and

  • Your currently running processes.

  • The file should be saved to an existing directory called log_dir which should be situated off your home directory


● To create a copy of a file.




  • The file should be in your current directory (the name of the file to be given by the user)

  • The destination directory name to be given by the user.

  • The script should error check that the file exists and is a normal file. If this is not the case then the script should allow the user to re-enter the filename until a valid filename is entered.

  • The script should check that the destination directory exists. If this is not the case then the script should allow the user to re-enter the destination directory until a valid directory is entered.


● To move the location of a file in your current directory (the name and destination to be given by the user)




  • The script should error check that the file exists and is a normal file. If this is not the case then the script should allow the user to re-enter the filename until a valid filename is entered.

  • The script should check that the destination directory exists. If this is not the case then the script should allow the user to re-enter the destination directory until a valid directory is entered.


● This script should loop continuously until the user chooses to quit.










share|improve this question















closed as too broad by Kevin Bowen, guntbert, Zanna, Charles Green, Eric Carvalho Dec 8 at 12:23


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 9




    This reads like a homework assignment. Is this such an assignment?
    – user535733
    Nov 30 at 0:34








  • 4




    The basic structure you want is covered in How can I create a select menu in a shell script? - the rest of your question is too broad IMHO
    – steeldriver
    Nov 30 at 1:05













up vote
0
down vote

favorite









up vote
0
down vote

favorite











The script should offer a menu with the following options:



● To create a backup copy of a script file.




  • The name of the backup copy should have backup after the name of the script and be date stamped e.g. Ass3Script_backup_10_11_2015.

  • It should be saved to your home directory using the Environment Variable for your home directory.

  • The script should error check that the file exists and is a normal file. If this is not the case then the script should allow the user to re-enter the filename until a valid filename is entered


● To create a date stamped log file called e.g. log_file_10_11_2015 containing:




  • A list of who is logged into the system,

  • The disk usage and

  • Your currently running processes.

  • The file should be saved to an existing directory called log_dir which should be situated off your home directory


● To create a copy of a file.




  • The file should be in your current directory (the name of the file to be given by the user)

  • The destination directory name to be given by the user.

  • The script should error check that the file exists and is a normal file. If this is not the case then the script should allow the user to re-enter the filename until a valid filename is entered.

  • The script should check that the destination directory exists. If this is not the case then the script should allow the user to re-enter the destination directory until a valid directory is entered.


● To move the location of a file in your current directory (the name and destination to be given by the user)




  • The script should error check that the file exists and is a normal file. If this is not the case then the script should allow the user to re-enter the filename until a valid filename is entered.

  • The script should check that the destination directory exists. If this is not the case then the script should allow the user to re-enter the destination directory until a valid directory is entered.


● This script should loop continuously until the user chooses to quit.










share|improve this question















The script should offer a menu with the following options:



● To create a backup copy of a script file.




  • The name of the backup copy should have backup after the name of the script and be date stamped e.g. Ass3Script_backup_10_11_2015.

  • It should be saved to your home directory using the Environment Variable for your home directory.

  • The script should error check that the file exists and is a normal file. If this is not the case then the script should allow the user to re-enter the filename until a valid filename is entered


● To create a date stamped log file called e.g. log_file_10_11_2015 containing:




  • A list of who is logged into the system,

  • The disk usage and

  • Your currently running processes.

  • The file should be saved to an existing directory called log_dir which should be situated off your home directory


● To create a copy of a file.




  • The file should be in your current directory (the name of the file to be given by the user)

  • The destination directory name to be given by the user.

  • The script should error check that the file exists and is a normal file. If this is not the case then the script should allow the user to re-enter the filename until a valid filename is entered.

  • The script should check that the destination directory exists. If this is not the case then the script should allow the user to re-enter the destination directory until a valid directory is entered.


● To move the location of a file in your current directory (the name and destination to be given by the user)




  • The script should error check that the file exists and is a normal file. If this is not the case then the script should allow the user to re-enter the filename until a valid filename is entered.

  • The script should check that the destination directory exists. If this is not the case then the script should allow the user to re-enter the destination directory until a valid directory is entered.


● This script should loop continuously until the user chooses to quit.







bash menu






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 30 at 0:47









karel

56k11124142




56k11124142










asked Nov 30 at 0:28









Mike

1




1




closed as too broad by Kevin Bowen, guntbert, Zanna, Charles Green, Eric Carvalho Dec 8 at 12:23


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as too broad by Kevin Bowen, guntbert, Zanna, Charles Green, Eric Carvalho Dec 8 at 12:23


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 9




    This reads like a homework assignment. Is this such an assignment?
    – user535733
    Nov 30 at 0:34








  • 4




    The basic structure you want is covered in How can I create a select menu in a shell script? - the rest of your question is too broad IMHO
    – steeldriver
    Nov 30 at 1:05














  • 9




    This reads like a homework assignment. Is this such an assignment?
    – user535733
    Nov 30 at 0:34








  • 4




    The basic structure you want is covered in How can I create a select menu in a shell script? - the rest of your question is too broad IMHO
    – steeldriver
    Nov 30 at 1:05








9




9




This reads like a homework assignment. Is this such an assignment?
– user535733
Nov 30 at 0:34






This reads like a homework assignment. Is this such an assignment?
– user535733
Nov 30 at 0:34






4




4




The basic structure you want is covered in How can I create a select menu in a shell script? - the rest of your question is too broad IMHO
– steeldriver
Nov 30 at 1:05




The basic structure you want is covered in How can I create a select menu in a shell script? - the rest of your question is too broad IMHO
– steeldriver
Nov 30 at 1:05










1 Answer
1






active

oldest

votes

















up vote
1
down vote













I won't write the whole answer but, parts you need come from this answer:




  • Backup Linux configuration, scripts and documents to Gmail


Bash script (updated) snippet:



# Running under WSL (Windows Subsystem for Ubuntu)?
if cat /proc/version | grep Microsoft; then
Distro="WSL"
else
Distro="Ubuntu"
fi

today=$( date +%Y-%m-%d-%A )
/mnt/e/bin/daily-backup.sh Daily-$(hostname)-$Distro-backup-$today


The file name generated by above code is:



Daily-alien-Ubuntu-16.04-Backup-2018-11-29-Thursday.tar.gz.64


Where:





  • $(hostname) produces alien (for an AW17R3 in case you are wondering).


  • $Distro produces Ubuntu (when not running under Windows 10).


  • $(lsb_release -sr) produces 16.04


  • $Today produces 2018-11-29-Thursday (Today's date)


You can find sample code for most of what you need to do all over this website and our sister website called Unix & Linux. There is a proliferate amount of code all over the internet as well.



It is best to just start writing your script and then when you run into problems with a specific line of code post a question on it. I would budget a week for you to get it done (just a wild guess-timate).






share|improve this answer




























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    I won't write the whole answer but, parts you need come from this answer:




    • Backup Linux configuration, scripts and documents to Gmail


    Bash script (updated) snippet:



    # Running under WSL (Windows Subsystem for Ubuntu)?
    if cat /proc/version | grep Microsoft; then
    Distro="WSL"
    else
    Distro="Ubuntu"
    fi

    today=$( date +%Y-%m-%d-%A )
    /mnt/e/bin/daily-backup.sh Daily-$(hostname)-$Distro-backup-$today


    The file name generated by above code is:



    Daily-alien-Ubuntu-16.04-Backup-2018-11-29-Thursday.tar.gz.64


    Where:





    • $(hostname) produces alien (for an AW17R3 in case you are wondering).


    • $Distro produces Ubuntu (when not running under Windows 10).


    • $(lsb_release -sr) produces 16.04


    • $Today produces 2018-11-29-Thursday (Today's date)


    You can find sample code for most of what you need to do all over this website and our sister website called Unix & Linux. There is a proliferate amount of code all over the internet as well.



    It is best to just start writing your script and then when you run into problems with a specific line of code post a question on it. I would budget a week for you to get it done (just a wild guess-timate).






    share|improve this answer

























      up vote
      1
      down vote













      I won't write the whole answer but, parts you need come from this answer:




      • Backup Linux configuration, scripts and documents to Gmail


      Bash script (updated) snippet:



      # Running under WSL (Windows Subsystem for Ubuntu)?
      if cat /proc/version | grep Microsoft; then
      Distro="WSL"
      else
      Distro="Ubuntu"
      fi

      today=$( date +%Y-%m-%d-%A )
      /mnt/e/bin/daily-backup.sh Daily-$(hostname)-$Distro-backup-$today


      The file name generated by above code is:



      Daily-alien-Ubuntu-16.04-Backup-2018-11-29-Thursday.tar.gz.64


      Where:





      • $(hostname) produces alien (for an AW17R3 in case you are wondering).


      • $Distro produces Ubuntu (when not running under Windows 10).


      • $(lsb_release -sr) produces 16.04


      • $Today produces 2018-11-29-Thursday (Today's date)


      You can find sample code for most of what you need to do all over this website and our sister website called Unix & Linux. There is a proliferate amount of code all over the internet as well.



      It is best to just start writing your script and then when you run into problems with a specific line of code post a question on it. I would budget a week for you to get it done (just a wild guess-timate).






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        I won't write the whole answer but, parts you need come from this answer:




        • Backup Linux configuration, scripts and documents to Gmail


        Bash script (updated) snippet:



        # Running under WSL (Windows Subsystem for Ubuntu)?
        if cat /proc/version | grep Microsoft; then
        Distro="WSL"
        else
        Distro="Ubuntu"
        fi

        today=$( date +%Y-%m-%d-%A )
        /mnt/e/bin/daily-backup.sh Daily-$(hostname)-$Distro-backup-$today


        The file name generated by above code is:



        Daily-alien-Ubuntu-16.04-Backup-2018-11-29-Thursday.tar.gz.64


        Where:





        • $(hostname) produces alien (for an AW17R3 in case you are wondering).


        • $Distro produces Ubuntu (when not running under Windows 10).


        • $(lsb_release -sr) produces 16.04


        • $Today produces 2018-11-29-Thursday (Today's date)


        You can find sample code for most of what you need to do all over this website and our sister website called Unix & Linux. There is a proliferate amount of code all over the internet as well.



        It is best to just start writing your script and then when you run into problems with a specific line of code post a question on it. I would budget a week for you to get it done (just a wild guess-timate).






        share|improve this answer












        I won't write the whole answer but, parts you need come from this answer:




        • Backup Linux configuration, scripts and documents to Gmail


        Bash script (updated) snippet:



        # Running under WSL (Windows Subsystem for Ubuntu)?
        if cat /proc/version | grep Microsoft; then
        Distro="WSL"
        else
        Distro="Ubuntu"
        fi

        today=$( date +%Y-%m-%d-%A )
        /mnt/e/bin/daily-backup.sh Daily-$(hostname)-$Distro-backup-$today


        The file name generated by above code is:



        Daily-alien-Ubuntu-16.04-Backup-2018-11-29-Thursday.tar.gz.64


        Where:





        • $(hostname) produces alien (for an AW17R3 in case you are wondering).


        • $Distro produces Ubuntu (when not running under Windows 10).


        • $(lsb_release -sr) produces 16.04


        • $Today produces 2018-11-29-Thursday (Today's date)


        You can find sample code for most of what you need to do all over this website and our sister website called Unix & Linux. There is a proliferate amount of code all over the internet as well.



        It is best to just start writing your script and then when you run into problems with a specific line of code post a question on it. I would budget a week for you to get it done (just a wild guess-timate).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 30 at 1:44









        WinEunuuchs2Unix

        41.4k1070156




        41.4k1070156















            Popular posts from this blog

            Ellipse (mathématiques)

            Quarter-circle Tiles

            Mont Emei