Changes between Version 4 and Version 5 of Ticket #3770, comment 5


Ignore:
Timestamp:
03/10/17 19:44:40 (8 years ago)
Author:
rdmo
Comment:

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` macro expansion. 
     1For 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. 
    22 
    33{{{ 
     
    88}}} 
    99 
     10What 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 
    1012From the single-line prompt in `mc` , `mc` does macro expansion in order: `mc` first (1), then `date` (2). 
    1113 
    1214{{{ 
    13 # date +%d                             # (1) 
    14 # date +/the/current/working/directory # (2) 
     15# date +%d                             # (1a) 
     16# date +/the/current/working/directory # (2a) 
    1517/the/current/working/directory 
    1618 
    17 # date +%%d # (1) 
    18 # date +%d  # (2) 
     19# date +%%d # (1b) 
     20# date +%d  # (2b) 
    192109 
    2022}}} 
     23 
     24In (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. 
    2125 
    2226Use of the double percent symbols `%%` resolves similarly simpler issues. For complex examples perhaps this is less so. 
     
    3135}}} 
    3236 
    33 Result in terminal window: 
     37The output in the terminal view is the number for the day of the month: 
    3438 
    3539{{{ 
     
    4650}}} 
    4751 
    48 Result in terminal window: 
     52The output in the terminal view is the directory name converted from `%d`. `date` has nothing to convert and just outputs the directory string: 
    4953 
    5054{{{ 
     
    5256/home/username 
    5357}}} 
    54  
    55 Note: edited for clarity and added the `mc.menu` info.