Changes

Jump to: navigation, search

Tutorial12: Shell Scripting - Part 2

25 bytes removed, 10:04, 4 August 2020
INVESTIGATION 3: USING STARTUP FILES
# Let's move your .bashrc file to prevent accidental overwrite.<br><br>Issue the following linux command:<br><span style="color:blue;font-weight:bold;font-family:courier;">mv ~/.bashrc ~.bashrc.bk</span><br><br>If you experience an error message "''No such file or directory''", just ignore since there is no startup file to backup.<br><br>
# Use a text editor like vi or nano to create the text file called '''~/.bashrc''' (eg. <span style="color:blue;font-weight:bold;font-family:courier;">vi ~/.bashrc</span>)<br><br>If you are using the nano text editor, refer to notes on text editing in a previous week in the course schedule.<br><br>
# Enter the following lines in your shell script:<br><span style="font-family:courier;">#!/bin/bashclear<br>clearecho -e -n "\e[0;34m"<br>set $echo "Last Time Logged in (lsfor security):"<br>echo Here are files in my current directory:"<br>echolastlog -u $USER<br>for xecho<br>do<br>&nbsp;&nbsp;&nbsp;echo -e -n " &nbsp;&nbsp;&nbsp;$x\e[m"<br>done</span><br><br>
# Save your editing session and exit the text editor (eg. with vi: press '''ESC''', then type ''':wx''' followed by '''ENTER''').<br><br>
# x
13,420
edits

Navigation menu