| add write access to current permissions for a file | chmod g+w filename |
| remove all access for this directory and subdirectories | chmod -r go-rwx * |
| remove write access from everyone but you | chmod go-w filename |
| replace current permissions for a file with those specifiedu=user, g=group, o=othersr=read, w=write, x=execute | chmod u=rwx,g=rwx,o=rwx filename |
| change group associated with files | chgrp newgroup filename |
| add all permissions for everyone | chmod 777 filename |
| change ownership of files | chown newowner filename |
Wednesday, March 30, 2011
Permissions
Just Some Miscellaneous Notes
Man / More / Less
[Spacebar] view next screen[Enter] view a line at a time
b view previous screen
q quit viewing
Naming Files
Tuesday, March 22, 2011
Documenting a Unix Script
#! /usr/bin/ksh
echo "# +-----------------------------------------------------------------------"
echo "# | Program ID: scriptname.sh"
echo "# |"
echo "# | Purpose: description"
echo "# |"
echo "# | Developer: Lynn Tobias"
echo "# | Program Date: mm/dd/yyyy"
echo "# |"
echo "# | Input File(s): /ux123/scripts/YES -- 'Y' for prompts"
echo "# | /ux123/scripts/ods_uat.password -- sql+ password"
echo "# |"
echo "# | Table(s) Used: EXT_BLDLIST"
echo "# |"
echo "# | Called by: ?"
echo "# | Calls: scriptname.pl"
echo "# |"
echo "# | Output: /ux123/scripts/blddist.file10"
echo "# | "
echo "# | Revisions: Dvlpr Date Version Comment/Change"
echo "# | ----- -------- ------- --------------------------------"
echo "# |"
echo "# +-----------------------------------------------------------------------"
echo "# +-----------------------------------------------------------------------"
echo "# | Program ID: scriptname.sh"
echo "# |"
echo "# | Purpose: description"
echo "# |"
echo "# | Developer: Lynn Tobias"
echo "# | Program Date: mm/dd/yyyy"
echo "# |"
echo "# | Input File(s): /ux123/scripts/YES -- 'Y' for prompts"
echo "# | /ux123/scripts/ods_uat.password -- sql+ password"
echo "# |"
echo "# | Table(s) Used: EXT_BLDLIST"
echo "# |"
echo "# | Called by: ?"
echo "# | Calls: scriptname.pl"
echo "# |"
echo "# | Output: /ux123/scripts/blddist.file10"
echo "# | "
echo "# | Revisions: Dvlpr Date Version Comment/Change"
echo "# | ----- -------- ------- --------------------------------"
echo "# |"
echo "# +-----------------------------------------------------------------------"
SQLPlus in a Here Document
This is called a 'here document' - because it says "here is the text for your input". The redirection expressed as "<<EOF" says "take what follows as though I typed it at the keyboard, until you find a token to match EOF as the first token on a line". The token EOF has no special meaning - it's just a string of characters used as a marker to tell the 'here document' when the text input is completed.
sqlplus <<EOF
Select something
from somewhere;
EOF
Important: the ending token must appear as the first characters on a line by itself.
Thanks to Jim Benz of Pittsburgh for these notes.
Monday, March 21, 2011
Password Variables
#! /usr/bin/ksh echo "#------------------------------------------------------------------------------" echo "# get passwords for the ftp and for sqlplus and assign to variables." echo "#------------------------------------------------------------------------------" export FTP_PASS='cat /ux123/dfact/xlt/scripts/ust_grp.password' export SQL_PASS='cat /ux123/dfact/xlt/scripts/xlt_ods_uat.password' echo "#------------------------------------------------------------------------------" echo "# start ftp from vax --i: turn off prompting n: turn off login" echo "#------------------------------------------------------------------------------" ftp -in host1 <quote user ust_grp quote pass $FTP_PASS ... quit EOF echo "#------------------------------------------------------------------------------" echo "# In SQL+, ... echo "#------------------------------------------------------------------------------" sqlplus -s $SQL_PASS << EOF . . exit; EOF
Grep
| match any character | . | grep l..n filename | finds 'lynn' or 'loan' |
| match only if at the beginning of a line | ^ | grep ^day filename | finds 'day into night'but not 'Some day' |
| match only if at the end of the line | $ | grep day$ filename | finds 'One fine day'but not 'Monday is good' |
| search for '.' or '^' or '$' in a file | \ | grep \* filename | finds '*****1.05' |
| search for a set of names | [] | grep [dog,dil]bert filename | finds 'dogbert' and 'dilbert' |
| find all lines that start with an alphabetic character in upper or lower case | ^[] | grep ^[A-Z,a-z] filename |
Subscribe to:
Posts (Atom)
