The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how can i create a simple progress bar in shell aditya.ece1985 Shell Programming and Scripting 5 11-30-2007 07:22 AM
How to create an run a simple batch file? Hyunkel UNIX for Dummies Questions & Answers 2 09-25-2007 09:21 PM
Modifying simple commands to create a script rocinante Shell Programming and Scripting 8 06-03-2007 10:35 PM
TODO: Sync User Tables Between Databases Neo Post Here to Contact Site Administrators and Moderators 0 09-20-2000 02:20 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-14-2002
sierra_aar sierra_aar is offline
Registered User
  
 

Join Date: Feb 2002
Location: Small country named: Israel
Posts: 24
Question How to create a simple todo file?

Hia all,

I am trying to create a simple script, that will keep me a todo file/log.
The idea is to have to scritps, one to enter a new todo file, one to delete (it can be one with different inputs, but this is not the point)

e.g.
> newEntry Call_home
- will add a new line to the log like that: - Call_home [TIME_STAMP]

>delEntry Call_home
- will update the current task's indicator to +

There are many more things I can think off, but this is for starters.

My Question is:
1. I have tcsh, where can I learn how to do what I want. (sites with examples are preferable)
2. If you can post a snipplet, that would be great.

thanks,
Me
  #2 (permalink)  
Old 02-14-2002
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
  
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
This looks suspiciously like homework / coursework...

Of course we would never post homework, right?

If I'm mistaken, please let me know.
  #3 (permalink)  
Old 02-17-2002
sierra_aar sierra_aar is offline
Registered User
  
 

Join Date: Feb 2002
Location: Small country named: Israel
Posts: 24
re: Cute


Long tim esince I laughed so hard

But I can understand, it definitly looks like homework.

I am 31 yrs, working as a programmer, only thing, I am a Windows person myslef (don't hate me for that). And csh, tcsh, sed awk, nawk and all these crazy words are still new to me.
I still can't tell the diffeence between ll and ls -tr.

Anyway, this is NOT homework for me, I am sure someone out there did get this as homework, but last time I got to do homeworks was 5 years ago on my B.Sc.

And now to my Q.
I did manage to change the '-' to '+' using SED, but it doesn't want to overwrite the file, so I thaught to use a second file to get the change, delete the first one, and rename. I know long, and not very system perfect, but it's work, and this is what I need. (as I said, I don't get points for short programs ^^)

I couldn't understand how to add a new line. I read the awk man files, but I am not sure if this is the tool I need.

If you can complete this hole for me, that's gr8.

Sierra_aar
  #4 (permalink)  
Old 02-17-2002
sierra_aar sierra_aar is offline
Registered User
  
 

Join Date: Feb 2002
Location: Small country named: Israel
Posts: 24
Lightbulb

OK, so I've spent some precious tim eI have and got this result.
It works, but I still have a question.

The Lockfile script is:
#!/usr/local/bin/tcsh -f

set fileName = "$1"
set DATE = `date '+%Y%m%d-%H%M'`

if (`echo $fileName | wc -c` < 3) then
echo "Please indicate name of file. > lkf [File Name]"
exit
endif

echo "- $1, $DATE" >> ~/locked_files.log
\sort -r ~/locked_files.log


and the release file script is:
#!/usr/local/bin/tcsh -f

set fileName = "$1"

if (`echo $fileName | wc -c` < 3) then
echo "Please indicate name of file. > frf [File Name]"
exit
endif

\sed 's/- '$fileName'/+ '$fileName'/' ~/locked_files.log > ~/locked_files.log2
\rm ~/locked_files.log
\mv ~/locked_files.log2 ~/locked_files.log
\sort -r ~/locked_files.log


Now, how can I add to the scripts, a message line? if I add a line, it get computed as different inputs, I want evreything after the file name to be treated as one parameter.

e.g.:
> lkf index.html Fixed image not showing error.

will go to the log file as:
- index.html, 20020217-1010, Fixed image not showing error.

???
  #5 (permalink)  
Old 02-17-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
Well, I don't really understand where you're going with your scripts and I'm not really a csh guy. But if I understand your final question, this may help:
Code:
#! /usr/local/bin/tcsh
set filename=$1
shift
set others="$*"
echo filename = $filename
echo others = $others
exit

Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:05 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0