If you really wanted to have a simple alias (without having to type the "$"), you could use ...
$ alias pmc='cd /inputdec/export/switch/pac/work'
then,typing...
$ pmc
$ pwd
/inputdec/export/switch/pac/work
The astrick is an indication that the file has the execute attribute set,
i.e., before
ls -l test => -rw-r--r-- duane61 18 Sep 3 18:52 test
after chmod +x test
then
ls -l test => -rwxr-xr-x duane61 18 Sep 3 18:55 test*
other symbols are appended when you edit a file (saves the original file...
I believe you were thinking of a function.
Example:
#!/usr/bin/ksh
#### Functions #####
Search ()
{
echo " "
echo "Enter the description that you would like to search for: "
read desc
if [ "$desc" ]
then
awk -f TNG-desc.awk workloadjobs.out | sed...
An easy way to trap the error and get the operator to retry is to make Dickie Bird's code (above) into a function. I say Dickie Birds because his error checking is much more rigorous!
Example:
#!/bin/sh
#### Functions #####
SetDate
{
.
Dickie Bird's code
.
}
#####################
# call to...
Ygor:
Your solution looks so tidy, but I get syntax errors when I try it, plus what if the date changes?
Try this on for size...a bit more complex, but works so well!
#!/bin/csh -f
# display the start date and time
set start_time = `date`
echo 'Starting on' $start_time[1-3] 'at'...
Depending upon your requirements and number of users, you may be able to do something similar to what I did...
if [ $LOGNAME = "bob" ] || [$LOGNAME = "dave" ]
then
<command>
else
echo "Not authorized"
fi
*This is rather simplistic, but all I really needed...
Thanks to you both...
I had used finger $LOGNAME|awk '{print $7}' | head -1, but I was hoping to add a tool to the library to identify/extract various fields without having to look it up or remember it.
vlad's debugging print fits that need! :-)
you guys are both great -
Duane
finger $LOGNAME results in:
login name: dawa In real life: David Wilson x 4223
Directory: /home/dawa Shell: /usr/bin/csh
On since Jul 2 11:13:50 on pts/55 from 191.x.xxx.xx:0.0
40 seconds idle time
No unread mail
No plan.
- - - - - - - - - - - - -
The desired output is simply to...
Okay, I bet this is easy, but can't seem to pull it out...
I want to do a for loop substitution in an awk line, sorta like this:
for i in 1 2 3 4 5 6 7 8 9
do
user=`finger $LOGNAME | awk '{print ${@}}'`
echo "Hello $user"
done
If I put a number in for {@}, I get that field, but I...
Maybe I'm missing something, but...
how about:
#!bin/sh
retreiveFtpInfo & # run FTP function in the background
retrieveFtpPid=$! # capture pid of last background process
then,
kill -9 $retrieveFtpPid # to kill the process if necessary
-or-
grep on...
kind of rudimentary, but maybe your system supports:
cat file1 file2 | sort | uniq -u > file3
where file3 will be the unique entries from the first two files.
Duane
Just from a quick look...I think you need to quote the * in your cat stmnt with a backslash [.\*] to interpret correctly.
As far as grep for different files and directories...depending on how many you got. You could use a FOR loop with the list of file names;
for filename in filename_1...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.