hi i never took any unix and my professor for one of my classes want me to write a shell script i am wondering if anyone can help
i need to Write a script that outputs all lines in a file containing a specific keyword.
Uh, why do you need a script for this when it can be done using two commands?
cat file | grep keyword
Example: [13:00:32 residentbiscuit@zenalpha ~ ]$ cat .bashrc | grep if
if [ "$PS1" ]; then
if [ -z "$PROMPT_COMMAND" ]; then
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
# if [ "$PS1" ]; then
# to your custom modification shell script in /etc/profile.d/ directory
if ! shopt -q login_shell ; then # We're not a login shell
if [ "$2" = "after" ] ; then
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
# Only display echos from profile.d scripts if we are no login shell
if [ -r "$i" ]; then
if [ "$PS1" ]; then
Also type "unix shell scripting tutorial for beginners" into youtube.
you dont even need youtube. there are hundreds of hits on google. also, i would specifiy a shell (more than likely bash) since thats what executes the shell script