Debian Codegraph @

tempfile-name.sh

raw symbols SCIP
1 #!/bin/bash
2 # tempfile-name.sh: temp filename generator
3
4 BASE_STR=`mcookie` # 32-character magic cookie.
5 POS=11 # Arbitrary position in magic cookie string.
6 LEN=5 # Get $LEN consecutive characters.
7
8 prefix=temp # This is, after all, a "temp" file.
9 # For more "uniqueness," generate the
10 #+ filename prefix using the same method
11 #+ as the suffix, below.
12
13 suffix=${BASE_STR:POS:LEN}
14 # Extract a 5-character string,
15 #+ starting at position 11.
16
17 temp_filename=$prefix.$suffix
18 # Construct the filename.
19
20 echo "Temp filename = "$temp_filename""
21
22 # sh tempfile-name.sh
23 # Temp filename = temp.e19ea
24
25 # Compare this method of generating "unique" filenames
26 #+ with the 'date' method in ex51.sh.
27
28 exit 0