1.2 KiB
1.2 KiB
LPIC-1 105.1: Customizing the shell environment
A personal bin directory in PATH, a shell function kept in ~/.bashrc,
and the skeleton files new users get.
Before you start
The lab creates user alice (password Lab-Pass-1). Do tasks 1 and 2 as
alice: log in as her, or run sudo -iu alice.
Tasks
- As
alice, make sure~/binis in herPATHpermanently, and put an executable script calledhellothere that prints a greeting. A new login shell must run it by name:sudo -iu alice hello. - Write the
mkcdfunction (make a directory, then change into it) and keep it inalice's~/.bashrc, so that it works in every new interactive shell of hers. - Put a file called
welcome.txtin/etc/skel, then create usernewbiewithuseradd -m, and check that the file is in the new home directory.
Hints
echo "$PATH",command -v hello;~/.profileor~/.bash_profile, and what the distribution's own startup files already do with~/bin.#!/bin/bash,chmod +x.mkcd() { mkdir -p "$1" && cd "$1"; }; test in a new shell withtype mkcd. A script can't do the same: why?ls -A /etc/skel,useradd -m,ls -la ~newbie.