How to create a simple todo file?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to create a simple todo file?
# 1  
Old 02-14-2002
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,
MeSmilie
# 2  
Old 02-14-2002
This looks suspiciously like homework / coursework...

Of course we would never post homework, right? Smilie

If I'm mistaken, please let me know.
# 3  
Old 02-17-2002
re: Cute

Smilie
Long tim esince I laughed so hard Smilie

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  
Old 02-17-2002
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  
Old 02-17-2002
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

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Create a simple bash backup script of a file

This is the problem: Write a script that will make a backup of a file giving it a ‘.bak’ extension & verify that it works. I have tried a number of different scripts that haven't worked and I haven't seen anything really concise and to the point via google. For brevity's sake this is one of the... (4 Replies)
Discussion started by: demet8
4 Replies

2. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

3. Shell Programming and Scripting

Create simple script

Dear all, I have a directory named A and some subdirectories named B, C, D with .xml files. I want to use the following command to strip the file. sed -re ':start s/<*>//g; /</ {N; b start}' file.xml > file.xml At the same time, I want to remove the blank lines using sed '/^$/d' How can... (6 Replies)
Discussion started by: corfuitl
6 Replies

4. Shell Programming and Scripting

How to create a simple copy script?

Guys I want to do this: copy: /var/router/system1/config/backup/install.put /var/router/system2/config/backup/install.put /var/router/system3/config/backup/install.put /var/router/system4/config/backup/install.put into: /var/router/system1/config/install.dat... (22 Replies)
Discussion started by: DallasT
22 Replies

5. Shell Programming and Scripting

How to create a simple shell script to backup

Hello - I am in process of deleting many files which are older than 4 weeks. For example I am inside: /subsystem/prod/ Files are with various extentions, but anything older than 4 weeks should be deleted. What would be the most simplest script to acheive this? (4 Replies)
Discussion started by: DallasT
4 Replies

6. Solaris

How to create a simple background script on Solaris

I have a local account for a unix server. The idle timeout for the account is around 10 mins. I have to login to the server multiple times during the day. Is there a way to increase the idle timeout or may be a script that I can run on background so it is not idle. Something like echo date every 9... (3 Replies)
Discussion started by: vinaysa
3 Replies

7. Shell Programming and Scripting

Simple Script to create folders

Hi I want to write a small script that will create folders named from `AAAA' all the way to `ZZZZ'. That is: `AAAA' `AAAB' `AAAC' ... `AABA' `AABB' `AABC' ... `ABAA' `ABAB' `ABAC' ... `ABBA' ... `ZZZZ' (4 Replies)
Discussion started by: ksk
4 Replies

8. UNIX for Dummies Questions & Answers

Create new simple System Call.

Hello to all! I am new with unix and i need your help to make something.. First of all i want to inform you that i am working under the Minix 3 OS. What i want to make is, a new system call in terms of the process manager. This system call should take an integer as a parameter (input) and... (1 Reply)
Discussion started by: kostis1904
1 Replies

9. UNIX for Dummies Questions & Answers

How to create an run a simple batch file?

Hi, So, I created a file named TEST.BAT in my home directory. In it, I wrote: #! /bin/bash echo Hello and then, saved the file. Then, at the command-line interface, I typed TEST.BAT, but the command-line never executes the file and thus, never returns "Hello". It says "command... (2 Replies)
Discussion started by: Hyunkel
2 Replies

10. Shell Programming and Scripting

Modifying simple commands to create a script

Can anyone direct me to a resource that explains scripting in simple terms? I have visited many sites and browsed this forum and have yet to find simple explanations. (8 Replies)
Discussion started by: rocinante
8 Replies
Login or Register to Ask a Question