|
#1
| |||
| |||
| Need help with shell scripts I need help with creating a shell script for a project at work. I know this doesn't have anything to do with Macs, but I need a little direction to get this project going. I just need to know when two text files "enterQ" (gets smaller over time) and "doneQ" (gets larger over time) haven't changed in 20 minutes. Any help would be greatly appreciated! I just need to be pointed in the right direction to get this project started. I have a UNIX Shells book at work, but it is old. I'm working with Sun workstations running Solaris 8. |
|
#2
| ||||
| ||||
| I can give you a few links, I think all of these are bash scripting which should be compatible with whatever flavor of nix your using. http://www.tldp.org/LDP/abs/html/ http://goforit.unk.edu/unix/assess.htm http://goforit.unk.edu/unix/unix14.htm http://www.macinstruct.com/tutorials/unix/ http://www.matisse.net/OSX/TOC.html Hope those help.
__________________ iMac G3 600Mhz, 256MB RAM, 40GB HD, 10.3.5 20GB iPod (Click Wheel) w/ Griffin iTrip // AIM:kjell05 |
|
#3
| ||||
| ||||
| Are you familiar with C/C++, if so you may want to look into tcsh and csh scripting, the shell scripts or the tcsh and csh use similiar syntax to C. I think there is some tcsh stuff at the link below, you may find more support for bash scripting though. http://www.shelldorado.com/links/
__________________ ON THE WAY: 15" PB 1.67|100|1024 --- 10.4 ------------------------------------------ 17" iMac G5 1.8|80|512|BT --- 10.3.9 FrankenMac G4 500|55|640 --- 10.3.9 PowerMac 9600 300|4|512 --- 1.2 eMachine 500is 500|4.3|196 --- OpenStep 4.2 Server 2.3|260|512 --- FedoraCore |
|
#4
| |||
| |||
| Quote:
I remember asking if there was a shell script or sequence of commands that did the equivalent of "getinfo" in the Finder. I know that Panther has a "getinfo" command in the terminal now, but before that, it didn't exist. Someone replied with a series of commands that gave the file name, creation date, modification date, size, etc... but I can't find the thread. I've searched though the forums and can't find the thread. Perhaps it was lost during a site crash. Gosh, I even saved that hint. I'm at work now, and I know I have it saved somewhere. I think seeing a small script like that would help me. All I need to do then is rename a file, and compare size and modification date 20 minutes later IF the file is greater than a specified minimal size. Anyone know how to do a "getinfo" using shell commands? |
|
#5
| ||||
| ||||
| just make sure you run chmod u=rwx on this file, i hope it does what you want it to, to use it just run it like any other unix command "getinfo /path/to/file". Good Luck! Code: #!/bin/bash echo "Current Working Directory is $PWD" ls -al | grep "$1"
__________________ ON THE WAY: 15" PB 1.67|100|1024 --- 10.4 ------------------------------------------ 17" iMac G5 1.8|80|512|BT --- 10.3.9 FrankenMac G4 500|55|640 --- 10.3.9 PowerMac 9600 300|4|512 --- 1.2 eMachine 500is 500|4.3|196 --- OpenStep 4.2 Server 2.3|260|512 --- FedoraCore |
|
#6
| |||
| |||
| Quote:
Thank you for the help. I'll have to try this when I get home. |
|
#7
| ||||
| ||||
| Your welcome , I hope that script works for you, if not post back and ill see what else i can think of.
__________________ ON THE WAY: 15" PB 1.67|100|1024 --- 10.4 ------------------------------------------ 17" iMac G5 1.8|80|512|BT --- 10.3.9 FrankenMac G4 500|55|640 --- 10.3.9 PowerMac 9600 300|4|512 --- 1.2 eMachine 500is 500|4.3|196 --- OpenStep 4.2 Server 2.3|260|512 --- FedoraCore |
|
#8
| |||
| |||
| I tried the script, it doesn't do what I want it to do. I was digging around the Apple Developer CD that comes with Panther. In order for me to get the "GetFileInfo" shell script/executable, I have to install the full Developer tools. I only have 2GB left on my HD, and the install requires 1.5GB. Guess I'll have to go without for a while until I can clear off some more stuff. I found the man page for it by using "locate GetFileInfo" and the path for the man page comes up, but no path for the command. |
![]() |
| Thread Tools | |
|
|