Script for data entry

Hello everyone. I just registered like 17 minutes ago and am new to UNIX/Linux. I work in a small department of an animation company that does compositing tricks to fix movie frames. After our work is completed we are tasked with creating a text log that has information on what work we had performed and basic shot information. I have taken C++ programming ages ago in a junior college, but barely remember anything. I want to create a script to make these log files for me and my co-workers. All of the information that goes into the logs are easily found in the terminal and it is just a matter of copying and pasting the information into a new file. Creating the files take anywhere from ten minutes to half an hour and it is a major pain in the butt.

The script I have created so far just echoes the easily found data onto the terminal for copying and pasting. That was the easy part. Now what I need is to figure out three more things to have an awesome script.

  1. I need a way to echo out the user name of the person that created a file in a different directory.

  2. Echo out my own user name.

  3. Echo a list of directories with "pf_" (e.g. pf_blurFix)

Again, I am a UNIX/Linux noob and don't have too much experience programming. Any help would be very much appreciated.

Here is my current script:

# This is a script to put in the basic info for the dreaded READMEs

#! /usr/local/bin/tcsh -fb

# "echo" everything on screen for copying
echo ================================================================================
echo Paint fix notes for:
a_get a_sq_name; a_get a_shot_name 
date +%D
echo 
echo SUP, TEAM
echo
echo ligherUsername, lighter
echo myUsername, pf
echo
echo Frames:
a_get a_firstfield; a_get a_lastfield
echo 
echo notes:
echo 
echo ________________________________________________________________________________
echo 
echo node info:
echo 
echo ================================================================================

I just figured out a way to echo my username:

cd ~; pwd|awk -F"/" '{print $NF}'

So I know that pwd shows your path, but I don't know what the stuff to the right of that does.

Also, for #1:
The name of the file is going to be "light.#.r"
The # can be found using this command:

a_get a_firstfield

I don't know how to use that in the script to echo the username of the person who created that file light.#.r though.

to echo your username

# whoami
root

pwd = shows current directory

awk -F"/" = splits output of pwd on every /

if you were in /usr/local/  it would split "usr" and "local"

'{print $NF}' prints 'Last field'
in this case it would print "local" as "usr" would be first field and "local" would be last field.

# cd /usr/local; pwd|awk -F"/" '{print $NF}'
local

Geeez. That whoami is pretty clever. Thanks Ikon.

I'm still working on this script and have run into a problem. Within a script, is it possible to navigate to other directories and list their contents? If I just type the command line in the terminal it works. But, if I use the script with the same command line, it doesn't work.

post your script so we can see what you are doing, or trying to do.

be sure to put in code tags.

So, I got it finished a little while ago. Here is what I got.

echo ================================================================================
echo Paint fix notes for:
a_get a_sq_name; a_get a_shot_name
echo 
date +%D 
echo 
echo SUP, TEAM
echo 
echo Paint fix artist:
whoami
echo 
echo Lighter:
ll `a_get a_shot_pic_dir`/r1/comp/light/light.`a_get a_firstfield`.r | awk '{ print $3}'
echo 
echo Frames: 
a_get a_firstfield; a_get a_lastfield 
echo 
echo Fix notes: 
echo 
echo ________________________________________________________________________________
echo 
echo Node info:
cd `a_get a_shot_pic_dir`/r1/layer/; ls -d pf_*
echo ________________________________________________________________________________
echo 
echo Extra notes:
echo 
echo ================================================================================

Thanks for the help everyone!!!