Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
*I want to Write shell script to print the this pattern:
1
22
333
4444
55555
*I want to Write shell script to compare the strings, check and see if a command
line argument matched the string "net321" print on screen "** string
matches ** " if not print "** string not matched **"
2. Relevant commands, code, scripts, algorithms:
3. The attempts at a solution (include all code and scripts):
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Prince Noura University
Riyadh
KSA
Dr.Monther
NET 321
we don't have a link
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
These are so basic I'm having a hard time not just giving the entire thing away.
Your first question needs two loops. You can use this kind of loop to generate each line:
And inside that loop, you need another loop, to generate the string:
You need to loop until STR is "$X" long, adding another character each time. You can get the length of STR with "${#STR}". See the advanced bash scripting guide and its test operators section, and my example below, to see how comparision inside [ ] brackets works.
For the second one:
Commandline arguments become $1 for the first one, $2 for the second, and so forth.
Remember not to forget the spaces. ["a"="a"] is wrong.
is valid.
If the first part of your question is not related to the second part, then just create a file, e.g name it something like a.sh, chmod it to 755 and echo all the numbers above:
it's really that simple, don't you have books and notes to refer to?
hi...
i want to print the below format by using shell scripting...plz help me
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Thanking u in advance...
regards
ram (1 Reply)
plz help me with this question :
1111 | aaaa | pppp | 23/9/87
3333 | dddd | oooo | 6/9/8
4444 | gggg | rrrr | 5/8/9
5555 | qqqq | eeee
ans:
5555 | qqqq | eeee
depending upon how many "|" are in the question
be quick.. (8 Replies)
this script reads source.txt and move
and random choice 6 files among 25 txt file
and renmame it..
but it is not executed..
whats problem?
#!/bin/ksh
while read line
do
cd $line/radmin
num=0
/bin/ls *.txt |
while read file_nm ; do
(( check = $RANDOM % 2 ))
if ; then
continue... (1 Reply)
hi
I have been given a new Sun fire V120 which i had no use for but my firend wished to host a maple story sever on it so i was happy to let him use it but i have run in to the problem that i have no clue how to configure it so he can use it if anyone can help we would realy appreciate it. Am... (1 Reply)
I am a newbie to Unix, I am using vi editor. I was able to print output to the screen using simple scripts. But when I tried a midlevel script I don't see anything on the screen and Cursor is just blinking when I type ./test11 filename. I have used chmod 755 also, but of no use. Any help would... (3 Replies)
alright, i just got this assignment. since im very new to unix programming, i would like to have some ideas about it. honestly, i dont even know what the hell he is asking for. plz see the attached pdf and help me out. thank you :( (2 Replies)
i'm pretty new to unix programming. i just wanna know how exactly fork(), waitpid() works. i have read some from the book, but it's still confusing. especially with those < 0 and == 0. plz help!!!! (1 Reply)