linux shell程式設計之選單選擇(二)

2021-06-11 10:46:14 字數 568 閱讀 5877

**:

#!/bin/bash

cat <50)print "disk space is used over 50%";else print "disk space is user below 50%"}'

;;d)

netstat -nptl | awk '/listen/'|awk -f/ ''

;;e)

ifconfig eth0 | awk -f"[ :]+" 'nr==2'

;;f)

echo -e "please input username"

read user

echo -e "please input password"

read pass

useradd $user

echo $pass | passwd --stdin $user

;;g)

awk 'end ~/.bash_history' | head

;;*)

printf "your input is wrong\n"

;;esac

linux shell程式設計之 if語句

一 語句格式 一行中的寫法 if test commands then consequent commands fi 多行的寫法 if 條件 then command else command fi 基本語法記住亮點 1 按照漢語的方式記憶 如果 if 那麼 then 就 否則 else 就 2 記...

Linux shell程式設計之awk sed用法詳解

awk的用法 1.awk的使用 呼叫方式 1.命令列方式 2.將所有awk命令插入乙個檔案,並使awk程式可執行,然後使awk命令直譯器作為指令碼的首行,以便通過鍵入指令碼名稱來呼叫它。3.將所有的awk命令插入乙個單獨檔案,然後呼叫。選項說明 f 域符號 預設為空格 f 指明awk指令碼 2.模式...

LINUX SHELL程式設計之遠端拷貝

使用expect,進行遠端拷貝 1.首先確認你的系統安裝有expect which expect 如果顯示如下,說明已經安裝完expect,如果沒有執行2 usr bin expect 2.yum install expect 3.遠端拷貝 usr bin expect f set password...