الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

الي يعرف كتابة shell script لليونكس بليززززز يساعد

مغلق
بدأه One-2-One في 29 نوفمبر 2003 · 5 رد · 2,087 مشاهدة · في نظام تشغيل Unix & Linux
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

مساعدة يا شباب عندي بعض المسائل مطلوب كتابة shell script

1) Write a script that takes a single command line argument, the login name of a user, and checks to see if that user is logged in. If the user is logged in the script should output "User xxx is logged in", if the user is not logged in the script should output "User xxx is not logged in" - where xxx is the login name of the user. If the user forgets to type the single argument an appropriate error message should be issued from your script.

2) Write a script, with no command line arguments or user input, whose output will be a function of the time of day the script is executed. If run between midnight and noon the script will output "Good morning, xxx", if run between noon and 6pm the script will output "Good Afternoon, xxx", and if run between pm and midnight the script will output "Good evening, xxx". Where xxx is the login name of the user.

3) Write a script called junk which takes one or more file names as arguments. The script should move each of the files specified to a subdirectory called .junk in your home directory. If the subdirectory does not exist the script should create it. The script should output to the screen the name of each file moved as well as the total number of files moved.

4) Write a script that manages a telephone directory(file). Each entry in the directory will contain first name, last name and telephone number. The script should be called "tel" and have the possible command line commands and arguments -

tel -a Harry Jones 521-2703 where -a means add the following first name, last name and telephone number to the directory

tel -f Jones where -f means find the entry for the last name and display it

tel -d Jones where -d means delete the entry for the last name

tel -s where -s means displays the directory sorted by last name

Your script should handle all error conditions gracefully i.e. invalid number of arguments, missing file, invalid option etc.

Here are some hints

- use positional arguments i.e. $1, $2 etc. to refer to the arguments on the command line

- use $1 to drive a case statement for the different options

- in order to write to the directory file use input and output redirection where the input comes from a string of variables specified on the command line and the output is the directory file called telephone

- refer to the man pages for the grep option which will allow you to delete lines containing a string, or rather copy all lines that don't have a specific string

بليز مساعدة .... موشرط كلهم اي وحدا فيهم

وشكرااااااااااااااااااااااااااا

#2

سلام

ودي أساعدك، بس واضح إنه homework أو امتحان، وإذا أعطيتك السكربت جاهزة راح أضرك..

أسأل عن أشياء محددة منت عارفها وأنا بالخدمة.. أما إني أكتب لك البرنامج فأعذرني، يمكن غيري يفيدك...

#3

شكرا voyageur

لنك خايف على مصلحتي...

بس هذا مو امتحان ولا هوم ورك.. هذا اسئلة بونس ... وانا ماعندي وقت عشان احلهم

ولا انا اقدر احلهم بس يبون وقت شوي..

واذا احد يحب يساعدني جزاه الله خير والي خايف على مصلحتي جزاه الله خير

وشكرااااااااااااا

تم تعديل هذه المشاركة بواسطة One-2-One في 1 ديسمبر 2003 في 00:43

#4

سلام

أشكرك على تفهمك وسعة صدرك،، وهذه سكربتات كتبتها لك، حلول الأسئلة من 1 إلى 3..

123.zip

#5

شكرااااااااااااااااااااااااااااااااااا voyageur

#6

شباب الي يعرف حل الباقي ..؟؟؟

الرجاء المساعدة

هذا الموضوع مغلق.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…