?? script-array.sh
字號:
#!/bin/bash# script-array.sh: Loads this script into an array.# Inspired by an e-mail from Chris Martin (thanks!).script_contents=( $(cat "$0") ) # Stores contents of this script ($0) #+ in an array.for element in $(seq 0 $((${#script_contents[@]} - 1))) do # ${#script_contents[@]} #+ gives number of elements in the array. # # Question: # Why is seq 0 necessary? # Try changing it to seq 1. echo -n "${script_contents[$element]}" # List each field of this script on a single line. echo -n " -- " # Use " -- " as a field separator.doneechoexit 0# Exercise:# --------# Modify this script so it lists itself#+ in its original format,#+ complete with whitespace, line breaks, etc.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -