[CONTENT] Shell Variable Default Value

中文

Content one: set default values for variables on command Line
1.1 Assign Values to Ordinary Variables

# a=1
# b=

(Add: let a be 1 and B be null as an example)

1.2 Set default values for variables on command Line

# var1=${a:-no}
# var2=${b:-no}


Add:
If a is null, var1 is no, otherwise var1 is equal to a
If B is null, var2 is no, otherwise var2 is equal to B

1.3 View variable results

# echo $var1
1
# echo $var2
no


Add:
The value of a is 1, so var1 is 1
The B is null, so var2 is no

Content two:set variable defaults in script
2.1 Setting variable defaults in scripts

# vim var_default.sh
Create the following:
#!/bin/bash
var_default="${1:-no}"
echo $var_default

(Add:If the variable of $1 is null, then var_default is no, otherwise var_default is equal to $1, and print it out as an example)

2.2 Test variable defaults in scripts

# bash var_default.sh
no
# bash var_default.sh 1
1
# bash var_default.sh 2
2
# bash var_default.sh 3
3

[CONTENT] Linux Partition Advice

中文

Content One: BIOS Partition Advice
1.1 Partition Planning

/boot    >= 5G
/var/tmp >= 10G
/tmp     >= 10G
swap     >= 2G
/        all remaining space

1.2 Standard Partition and Logical Partition

/boot    Use standard partition
/var/tmp Use logical partition
/tmp     Use logical partition
swap     Use logical partition
/        Use logical partition

1.3 Format

/boot    xfs
/var/tmp xfs
/tmp     xfs
swap     swap
/        xfs

1.4 Mount Parameter

/boot    defaults
/var/tmp rw,nosuid,nodev,noexec,relatime,strictatime
/tmp     rw,nosuid,nodev,noexec,relatime,strictatime
swap     defaults
/        defaults

Content Two:EFI Partition Advice
2.1 Partition Planning

/boot/efi >= 5G
/var/tmp  >= 10G
/tmp      >= 10G
swap      >= 2G
/         all remaining space

2.2 Standard Partition and Logical Partition

/boot/efi Use standard partition
/var/tmp  Use logical partition
/tmp      Use logical partition
swap      Use logical partition
/         Use logical partition

2.3 Format

/boot/efi vfat
/var/tmp  xfs
/tmp      xfs
swap      swap
/         xfs

2.4 Mount Parameter

/boot/efi defaults
/var/tmp  rw,nosuid,nodev,noexec,relatime,strictatime
/tmp      rw,nosuid,nodev,noexec,relatime,strictatime
swap      defaults
/         defaults

Friedrich Wilhelm Nietzsche (弗里德里希·威廉·尼采):

Reading history makes people wise, poetry witty, mathematics thoughtful, science profound, ethics solemn, logic and rhetoric makes people eloquent.

读史使人明智,读诗使人灵秀,数学使人周密,科学使人深刻,伦理学使人庄重,逻辑修辞之学使人善辩;凡有所学,皆成性格。