I am a rookie regarding shell script programming, YET!! :-)
Hence, I have choosen a problem from my bad side of life (my job) and I wil try to solve it by using a shell script and get knowledge concerning shell script programming.
Question: As you can see I have already figured out how to use a function, variables, different standard funtions (if, loops,etc). But I struggeld by using the printf function in order to add blanks to string. If the string which I pass into the function is longer than 40 digits then the printf function has to shorten string to 40 digits. This function works perfectly but if the string is shorter than 40 digits then the printf function has to add blanks until the string has a lenght of 40 digits but this part of my shell script doesn't work !!! The function adds only ONE blank
if anyone can give an advice it would be great!!!!
Thanks in advance and cold but sunny greetings form BERLIN Area!
Noobie1995
P.S.: I am so sorry for my english it has been a while..........
Great, it works but you can imagine it brings me to some more questions:
1. why I have to pass the value variable into ""?
2. I have extended the code (green lines) and the code brings the previous[incorrect result]?
Try:
You do not need the double quotes with the assignment, but you do need them with the echo statement, otherwise the content of the variable will be interpreted by the shell and split into fields using IFS (the input field selector)..
This User Gave Thanks to Scrutinizer For This Post:
And the same rule applies here:
value= is an assignment, no need for quotes.
$2 is an argument (of the printf command), to be quoted.
---------- Post updated at 12:37 PM ---------- Previous update was at 12:27 PM ----------
The exception proves the rule:
These are arguments to the [ ] (test) function.
The $3 should be quoted if can be tampered with, e.g. became a * or 1 2.
Not needed, if your script guarantees a number.
The ${#2} is always a number.
This User Gave Thanks to MadeInGermany For This Post:
Hi all,
that's my personal "war story" and probably a beginning of a never ending love story.
It is roughly 8 weeks ago, I've got a training for a new ERP system. In front of the training my boss mentioned it based on a unix. Great, I have been always interested in but I don't know why I... (2 Replies)
This is my situation
DOS pc serial cable (sl0) Linux Pc eth1
192.168.0.10 <-------------------->192.168.0.2 <------------>192.168.0.1 (router)
I connected the linux pc and the dos pc with a SLIP (serial line internet protocol), so they can communicate in the sl0 interface.
... (3 Replies)
Hi, folks,
A new release, v.0.30.1, of CK-ERP, has been posted, at SourceForge.Net, sourceforge.net/projects/ck-erp .
New features comprise seven new modules (ck-teacher, ck-counsellor, ck-student, ck-applicant, ck-family, ck-registrar, ck-eduadmin) for deployment within educational... (0 Replies)
Hi all
I have installed a demo version of SCO OpenServer 5.0.2, I finally found it is Desktop Interface, I would like to know how to change its interface to dos based interface?
If you have any ideas, please tell me then. Thank you (2 Replies)
Dear all,
I am a newbie in solaris and I need your advice.
I have a Solaris version 5.9 installed on Sunfire V240.
I am able to ssh the machine from putty remotely.
My problem is that I cannot see the display from KVM switch I have connected to it. I need also to be able to see the GUI... (2 Replies)
I would like to know what means this error and how to fix it
Command 'rm -f -r "0yfOYy-0008Nq-2j-32233-K"'
failed with return code 1 and error message
Thank you (3 Replies)
Hi, folks,
I have developed CK-ERP, which is an open source accounting / MRP / ERP / CRM system that runs on top of multiple middlewares. It provides accounting and back office functionalities to SMEs and utilizes the underlying middleware to administer accounts/groups.
Details about and... (0 Replies)