Posts

Showing posts from October 22, 2018

What is it I am doing wrong using `tl_case:Nn …`?

Image
Clash Royale CLAN TAG #URR8PPP up vote 1 down vote favorite When using document command arguments for case distinctions I routinely have been using the str_case:nn function, which works fine as is evident from the output of the myStrCase command. When attempting to use the tl_case:Nn function instead, by loading the argument into a _tl type variable, things go miserably wrong. The variable seems to be loaded with the correct value, and is then flagged as correct as far as the tl_case:Nn function is concerned, but the corresponding code is not executed. Why? documentclassarticle %======================= usepackage[check-declarations,log-functions]expl3 usepackagexparse %----------------------- ExplSyntaxOn tl_new:N l_rn_Aux_tl NewDocumentCommandmyStrCaseOemphm str_case:nnTF #1 emphtextit#2 Emphtextbftextit#2 ulineunderline#2 !~ERROR:~parameter~#1~=~#1~invalid % myStrCase NewDocumentCommandmyTlCaseOemphm tl_set:Nx l_rn_Aux_tl #1 checking~what~was~passed:~l_r...

Command substitution: splitting on newline but not space

Image
Clash Royale CLAN TAG #URR8PPP up vote 27 down vote favorite 5 I know I can solve this problem several ways, but I'm wondering if there is a way to do it using only bash built-ins, and if not, what is the most efficient way to do it. I have a file with contents like AAA B C DDD FOO BAR by which I only mean it has several lines and each line may or may not have spaces. I want to run a command like cmd AAA "B C DDD" "FOO BAR" If I use cmd $(< file) I get cmd AAA B C DDD FOO BAR and if I use cmd "$(< file)" I get cmd "AAA B C DDD FOO BAR" How do I get each line treated a exactly one parameter? bash command-substitution share | improve this question edited Oct 10 '14 at 10:49 peterph 22.8k 2 43 57 asked May 27 '12 at 21:22 Old Pro 574 2 5 14 question with +922 total votes: How do I split a string on a delimiter in Bash? – Trevor Boyd Smith Jun 17 '16 at 14:5...