Changes between Version 4 and Version 5 of Ticket #3770, comment 5
- Timestamp:
- 03/10/17 19:44:40 (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #3770, comment 5
v4 v5 1 For example: the `date` command and `mc`'s macro expansion. Access is via the full-screen prompt – `bash` on my system – toggled using `C-o`. There is no `mc` macroexpansion.1 For example: the `date` command and `mc`'s macro expansion. Access is via the full-screen prompt – `bash` on my system – shown by typing `C-o`. There is no `mc` macro expansion, only `date` expansion. 2 2 3 3 {{{ … … 8 8 }}} 9 9 10 What happens? `mc` passes the string to the shell which runs the `date` program. `%d` converts to the current calendar day number for the month. `date` interprets `%%` to a string literal "%", meaning the output is "%d". 11 10 12 From the single-line prompt in `mc` , `mc` does macro expansion in order: `mc` first (1), then `date` (2). 11 13 12 14 {{{ 13 # date +%d # (1 )14 # date +/the/current/working/directory # (2 )15 # date +%d # (1a) 16 # date +/the/current/working/directory # (2a) 15 17 /the/current/working/directory 16 18 17 # date +%%d # (1 )18 # date +%d # (2 )19 # date +%%d # (1b) 20 # date +%d # (2b) 19 21 09 20 22 }}} 23 24 In (1a), `mc` converts `%%` to `%`. In (1b), `mc` converts `%%` to `%`. In (2a), `date` converts nothing and just passes the string that is the current directory, with nothing to convert. In (2b), `date` converts `%d` to the current calendar day number for the month. 21 25 22 26 Use of the double percent symbols `%%` resolves similarly simpler issues. For complex examples perhaps this is less so. … … 31 35 }}} 32 36 33 Result in terminal window:37 The output in the terminal view is the number for the day of the month: 34 38 35 39 {{{ … … 46 50 }}} 47 51 48 Result in terminal window:52 The output in the terminal view is the directory name converted from `%d`. `date` has nothing to convert and just outputs the directory string: 49 53 50 54 {{{ … … 52 56 /home/username 53 57 }}} 54 55 Note: edited for clarity and added the `mc.menu` info.