Bashã®æ¹è¡æå
Bashã®ç¥ããªãã£ãæ©è½ã
stty -icrnl
ã§ãCRã®NLã¸ã®ç½®æãææ¢ãã¦ãã対話åBashã§ã¯ãEnterãCtrl-Mã§ã³ãã³ããå®è¡åºæ¥ãã
cat -v
ã«EnterãCtrl-Mãä¸ãã¦ã¿ãã¨ãã¡ããã¨^M
ã¨è¡¨ç¤ºãããstty -icrnl
ãå¹ãã¦ãããã¨ããããã
$ echo $'pwd\rls\r' | bash bash: è¡ 1: $'pwd\rls\r': ã³ãã³ããè¦ã¤ããã¾ãã $ echo $'pwd\rls\r' | bash -i ã¡ããã¨pwdã¨lsãå®è¡ããã
ããããæ¹è¡æåãCRLFã®ãã¡ã¤ã«ãå®è¡ããæã«ãbash -i ãã¡ã¤ã«å
ã§è¯ãã®ãã¨ããã¨é§ç®ã
$ echo $'pwd\rls\r' > foo $ bash -i foo bash: $'pwd\rls\r': ã³ãã³ããè¦ã¤ããã¾ãã $ bash -i < foo ããã¯ä¸è¨ã¨åããã¡ããã¨å®è¡ããã
bash -i < ãã¡ã¤ã«å
ãªãOKã
追è¨ï¼
æ稿ã®æ°åå¾ããµã¨ãããã¯readlineã®æ©è½ã§ã¯ç¡ããï¼ï¼ã¨æãã¤ããbash --noediting -i
ã¨ãã¦ã¿ãã¨ãEnterãCtrl-Mã§ã¯ã³ãã³ãå®è¡åºæ¥ãªãã^M
ã¨è¡¨ç¤ºãããã ãããã£ã±ãreadlineã ã£ãããã ã
$ bind -p | grep "C-[jm]" "\C-j": accept-line "\C-m": accept-line