Sponsored Content
Homework and Emergencies Homework & Coursework Questions i made this tasks. and i need some explenation or just remake my code. Post 302426052 by pseudocoder on Monday 31st of May 2010 02:08:26 PM
Old 05-31-2010
3. https://www.unix.com/homework-coursew...processes.html

---------- Post updated at 19:26 ---------- Previous update was at 19:20 ----------

Quote:
Originally Posted by eclip
tywm for that..
but i was wondering if u can make something like that?
Yep, but don't forget to comment the comment, see red mark:

Quote:
Originally Posted by eclip
Code:
 i have done something like this..

#!/bin/bash	

while true do

  for rac in `cat $1` ; do	
  
    ping -c 3 $rac || echo "Ta racunalnik $i ob `date +%T` ni dosegljiv" >>dnevnik_nedosegljivih.txt #(kamor se vpiše njegovo ime in čas, ko ni bil dosegljiv)
	
   done
   
 sleep 300 #(5min*60sec=300 sec)
 
done

exit 0

and don't forget the semicolon in the for line, also see red mark.

---------- Post updated at 20:08 ---------- Previous update was at 19:26 ----------

1. Can you accept usage like rename .txt .doc Smilie If yes, check this:

Code:
#!/bin/sh

for i in *$1; do
mv "$i" "${i%.*}$2"
done

Test run:
Code:
$ ls
gport.py	label.py	monk.py		rename.sh	test.py
$ ./rename.sh .py .pl
$ ls
gport.pl	label.pl	monk.pl		rename.sh	test.pl
$


Last edited by pseudocoder; 05-31-2010 at 02:36 PM..
This User Gave Thanks to pseudocoder For This Post:
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Repetitive Tasks

Could someone tell me how I can simplify the script that follows!!! I know that there must be a way how to grep Average from sar01.................. sar02 ....................... sar03....................... sar04... (3 Replies)
Discussion started by: JairGuerra
3 Replies

2. UNIX for Dummies Questions & Answers

Need help with tasks!

Hi guys! I have a dummy question for u :p I cant find a solution for these tascks...tried everything (i know :cool: ). 1 Issue the following command sleep 1000 Note that sleep 1000 waits 1000 seconds!!! You cannot do anything now!!! 2 Open another terminal window and enter the tty... (1 Reply)
Discussion started by: RomeO
1 Replies

3. AIX

Junior SA Tasks?

I've been given more responsibility at work and was basically told to take junior system admin responsibilities over our aix box. The catch is, I need to learn on my own. I know basics, but what are some task that I could perform on a daily basis for starters? We have a support group, but not so... (2 Replies)
Discussion started by: NycUnxer
2 Replies

4. Shell Programming and Scripting

schedule tasks

As far as I know Crontab is the utulity to schedule tasks to run at specific times.Is there any utility to perform the same task (4 Replies)
Discussion started by: tjay83
4 Replies

5. Homework & Coursework Questions

Hello.. can someone help my with this tasks?

1. Write a shell program which renames the current directory with the given file extension to another extension. The playoffs are given on the command line. Example usage: $ Rename txt doc will be renamed: aaa.txt in aaa.doc Juhutxt in Juhudoc ... * To solve, you can also help with... (5 Replies)
Discussion started by: eclip
5 Replies

6. UNIX for Beginners Questions & Answers

[Tip] Housekeeping Tasks Made Easy - User Home directories and Leftover Files

We have regularly questions about how to create users and user accounts. But regularly user accounts need to be deleted too. It is quite easy to delete the user account itself but usually the HOME directory of the user remains. It is good style to remove these directories but simply deleting... (3 Replies)
Discussion started by: bakunin
3 Replies
All times are GMT -4. The time now is 07:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy