Shell script ( beginner)

Hello guys this is my first time working on project like this ! can someone please help me ?
I have no idea where to start and it's really important to improve my grades ! i need someone to try this and send me the script so i can analyse it and understand it ! PLEASE

**Write the show_usage function which displays on standard output the message in the form following with the display of the appropriate options: & quot; sauv_favori: [-h | --help] [-T] [-t] [-n] [-N] [-d] [-m] [-s] path **
65. The script must test for the presence of at least one argument, otherwise it displays the usage on the
output error and fail.
66. function called HELP which displays help from a text file containing a
detailed description of the application.
Options

• -a: This option evokes a function which takes an argument (a string without space)
and add the path (after verifying its existence) to your favorites list.
• NB: list of favorites (a file which contains lines. Each line is a path
absolute of a directory or file.
• -c: This option triggers a function that moves to a favorite directory. This
function takes one argument (a string without spaces) and searches the favorites list. Yes
the favorite exists, the function changes the working directory, otherwise, it does nothing.
• -r: Remove a favorite from the list
• -l: display the list of all favorites with the option
• -h: the -h option to display detailed help from a text file
• -g: to display a graphic menu (example via YAD)
• -m: to display a text menu (loop menu)
• -s: save images passed as argument by the -s option in a
• Favorite_images directory, check their number of pixels and set them to a value at the
choice if they exceed 700x700.
-n: To rename the saved images adopting this format
NAME_DATE_TIME.jpg
• -h: To display detailed help from a text file

Pg. 24

• -g: To display a textual menu and manage the functionalities in a
graph (Using YAD).
• -v: To display the name of the authors and version of the code.
• -m: To display a text menu

Hello,

Welcome to the forum. We are certainly happy to help you in terms of answering specific questions, explaining particular concepts, and providing generic examples of approaches to solving a problem. However, we cannot do what you have asked, which is to "try this and send [you] the script". This is your coursework, and consequently the actual work you create and submit has to be entirely your own.

As I say, we are generally more than happy to help you with getting to grips with the ideas, concepts and skills you'll need to deploy in writing this script, but the actual writing has to be done by you.

So, if you have an attempt at a solution of your own that you've been struggling to get working, or if you have specific questions about particular points of the problem specification, please do show us your work so far or let us know what you'd like to know, and we can take things from there.

2 Likes

Hey thanks for the reply, i only need to know how can i display a graphic menu i got the rest all worked out last night

Hello,

Glad things have worked out for you - hopefully you've learned quite a bit in developing a script like this in such a relatively short space of time.

Regarding your remaining point, the use of yad. I've not used it before myself, but I've just been quickly testing out a few things, and it seems relatively straightforward, certainly in comparison to the many things mentioned in your problem specification that I'm pleased to hear you have gotten to grips with since you first posted.

At its simplest, yad can be used to display dialog boxes in a manner such as this:

/usr/bin/yad --title="Test" --text="Test dialog box" --button="OK" --button="Cancel"

So, you use the flags mentioned above to set the title, the text you want displayed, and the names of the buttons. The exit value of yad is then set depending on which button is clicked - 0 for the first button, 1 for the second, and so on. So all you have to do is examine the exit value of the yad command in your script after yad is run, and figure out which button the user clicked by seeing what it's been set to.

Hope this helps !

4 Likes

It worked ! Thank you !

2 Likes

@iyedbhd, we neither allow nor tolerate homework cheating of any kind at these forums.
Please consider this as a warning.

1 Like

Hello,

Welcome to the forum. As my fellow moderator vgersh99 has already stated, this is not the kind of assistance we would provide here. We are more than happy to help students who have questions about work that they have been assigned, and indeed encourage you to ask such questions. But the assistance we would provide would very strictly take the form of helping you to understand the skills, concepts and technologies that you would need to master in order to enable you to complete your own work successfully.

I realise it's very tempting - and easier than ever, these days - to find others to do technical coursework for you. But I sincerely encourage you to re-think this. Firstly, you will fail to gain a deep and lasting understanding of what you are studying, thus making the time and money you are spending on your studies worthless.

But as well as that, cheating will ultimately backfire, as any half-way decent instructor will be able to easily see that the work you have submitted does not match up with the level of understanding that you otherwise exhibit. There is no point in turning in a script you didn't write yourself, as when you are questioned about the script, or asked to demonstrate the principles that were used to write it in other circumstances, you'll be unable to do so.

In other words: you will be caught, sooner or later. And the consequences for being caught cheating are going to be far, far worse than the consequences for submitting work that might not fully meet the brief you've been given, or which is not 100% working as your instructor desires. It is always better to be honest, and to show your instructor your own work.

And please, never hesitate to ask questions. Asking questions, and letting others know that you don't understand something, is not a weakness - quite the contrary, it is a strength. Admitting when and where you need help or further instruction is the only way you will make progress, and fill in the gaps in your training that need to be filled.

I hope that you take this message to heart, and re-consider going down this particular path. Taking your time and doing the hard work required to understand and complete a task is always the better choice than taking the quick and easy path of cheating.

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.