Development > Scripting and Bash

[SOLVED] Program error

(1/3) > >>


this is the script -

this is the error message on option 3 only

I set the shell script permissions to -

--- Code: ---chmod 755
--- End code ---

As it was what the book specified to use in the first chapter of the shell scripting chapters.

I checked the "18G..." results with error , by changing lines #33 and #36 by adding

--- Code: ---sudo
--- End code ---

the program produces no error, but of course it needs the password to be typed, this confirmed the results of "18G...", as correct. In that the script, as in screenshot above, has the permission denied error but is producing the correct results shown on the next line in the terminal after the error, on the screenshot above.

Options 1, 2, and 0 work without any errors in the program.
The only changes I have made to the script from the book is to beautify the code alignment to my liking.
The error happens before this when run, and still does, so it has not affected the programs functioning.

I would like some help as to how to run this script on option3 without it producing the error.

I was playing with the du command in my terminal and could replicate a permissions error - although not the same file as you...
using 'du -sh /home' or 'du -sh /home/*'

What did yield the results without error was 'du -sh ~'

--- Code: ---du -sh ~
--- End code ---

May be worth a try in your script... ??? ...
- Also I'd be curious to the top 14 lines of your script - looks like a nice piece of coding :)

Hope it helps!!!

*** Sorry ~ shows your home directory only.. Missed the need for "others/all users"  got caught up playing LOL ****

***2nd Edit - Although your error is in your own home, perhaps permissions are pooched on your files? See this link  ***
To make your user owner of the files in your home directory

Good Luck

@firenice03 here are the top 14 lines and onwards a bit

Thank You I will give these a try :)
Just looking at edit 2

@firenice03 2nd Edit has solved it , thank you  8)

Option 0 screenshot

Option 1, 2, 3 , and a screenshot showing the error message for a number entered outside of the 0-3 options.

@bitsnpcs cool glad it helped, yeah I might mimic that script of yours :)


[0] Message Index

[#] Next page

Go to full version