Write structured commands in multiple lines with tab key activated

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite
1












I'd like to write structured command in multiple lines as



$ for i in *;
→ do
→ file $i;
→ done
bmdt.md: ASCII text
breakfast.md: ASCII text
brmdh.md: ASCII text
test.sh: Bourne-Again shell script text executable, ASCII text


but find the tab not working,



How could I activate the tab key in the bash console?










share|improve this question







New contributor




avirate is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1




    press Control-V Tab instead; Tab is bound to file/command completion by default.
    – mosvy
    21 mins ago















up vote
4
down vote

favorite
1












I'd like to write structured command in multiple lines as



$ for i in *;
→ do
→ file $i;
→ done
bmdt.md: ASCII text
breakfast.md: ASCII text
brmdh.md: ASCII text
test.sh: Bourne-Again shell script text executable, ASCII text


but find the tab not working,



How could I activate the tab key in the bash console?










share|improve this question







New contributor




avirate is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1




    press Control-V Tab instead; Tab is bound to file/command completion by default.
    – mosvy
    21 mins ago













up vote
4
down vote

favorite
1









up vote
4
down vote

favorite
1






1





I'd like to write structured command in multiple lines as



$ for i in *;
→ do
→ file $i;
→ done
bmdt.md: ASCII text
breakfast.md: ASCII text
brmdh.md: ASCII text
test.sh: Bourne-Again shell script text executable, ASCII text


but find the tab not working,



How could I activate the tab key in the bash console?










share|improve this question







New contributor




avirate is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I'd like to write structured command in multiple lines as



$ for i in *;
→ do
→ file $i;
→ done
bmdt.md: ASCII text
breakfast.md: ASCII text
brmdh.md: ASCII text
test.sh: Bourne-Again shell script text executable, ASCII text


but find the tab not working,



How could I activate the tab key in the bash console?







bash






share|improve this question







New contributor




avirate is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




avirate is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




avirate is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 28 mins ago









avirate

36429




36429




New contributor




avirate is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





avirate is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






avirate is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 1




    press Control-V Tab instead; Tab is bound to file/command completion by default.
    – mosvy
    21 mins ago













  • 1




    press Control-V Tab instead; Tab is bound to file/command completion by default.
    – mosvy
    21 mins ago








1




1




press Control-V Tab instead; Tab is bound to file/command completion by default.
– mosvy
21 mins ago





press Control-V Tab instead; Tab is bound to file/command completion by default.
– mosvy
21 mins ago











1 Answer
1






active

oldest

votes

















up vote
4
down vote













When you press Enter after entering an incomplete command, the bash shell will show a continuation prompt (the secondary prompt, $PS2) and allow you to complete the entered command. The command line editing facilities of the shell at that point is the same as at the original prompt (the primary prompt, $PS1), which means that the Tab key would do command and filename completion as usual.



To insert a tab character, use Ctrl+V Tab, or use spaces for indentation. Tab characters (or any other literal character) can always be inserted if prefixed by Ctrl+V.



Alternatively, if in Emacs command line editing mode (which I believe is the default in bash), use Ctrl+X Ctrl+E to bring up an editor to enter your command into. The editor used will be the one specified by the EDITOR shell/environment variable, or emacs if this variable is unset.



In Vi command line editing mode, press Escape v to do the same thing.



The command will be executed after saving and exiting the editor.






share|improve this answer






















  • Could I ask What's vi command line, I am aware the Vim is a editor which should be opened in advance, go inside, and edit, rather than directly type into command and run.
    – avirate
    2 mins ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






avirate is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478231%2fwrite-structured-commands-in-multiple-lines-with-tab-key-activated%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote













When you press Enter after entering an incomplete command, the bash shell will show a continuation prompt (the secondary prompt, $PS2) and allow you to complete the entered command. The command line editing facilities of the shell at that point is the same as at the original prompt (the primary prompt, $PS1), which means that the Tab key would do command and filename completion as usual.



To insert a tab character, use Ctrl+V Tab, or use spaces for indentation. Tab characters (or any other literal character) can always be inserted if prefixed by Ctrl+V.



Alternatively, if in Emacs command line editing mode (which I believe is the default in bash), use Ctrl+X Ctrl+E to bring up an editor to enter your command into. The editor used will be the one specified by the EDITOR shell/environment variable, or emacs if this variable is unset.



In Vi command line editing mode, press Escape v to do the same thing.



The command will be executed after saving and exiting the editor.






share|improve this answer






















  • Could I ask What's vi command line, I am aware the Vim is a editor which should be opened in advance, go inside, and edit, rather than directly type into command and run.
    – avirate
    2 mins ago














up vote
4
down vote













When you press Enter after entering an incomplete command, the bash shell will show a continuation prompt (the secondary prompt, $PS2) and allow you to complete the entered command. The command line editing facilities of the shell at that point is the same as at the original prompt (the primary prompt, $PS1), which means that the Tab key would do command and filename completion as usual.



To insert a tab character, use Ctrl+V Tab, or use spaces for indentation. Tab characters (or any other literal character) can always be inserted if prefixed by Ctrl+V.



Alternatively, if in Emacs command line editing mode (which I believe is the default in bash), use Ctrl+X Ctrl+E to bring up an editor to enter your command into. The editor used will be the one specified by the EDITOR shell/environment variable, or emacs if this variable is unset.



In Vi command line editing mode, press Escape v to do the same thing.



The command will be executed after saving and exiting the editor.






share|improve this answer






















  • Could I ask What's vi command line, I am aware the Vim is a editor which should be opened in advance, go inside, and edit, rather than directly type into command and run.
    – avirate
    2 mins ago












up vote
4
down vote










up vote
4
down vote









When you press Enter after entering an incomplete command, the bash shell will show a continuation prompt (the secondary prompt, $PS2) and allow you to complete the entered command. The command line editing facilities of the shell at that point is the same as at the original prompt (the primary prompt, $PS1), which means that the Tab key would do command and filename completion as usual.



To insert a tab character, use Ctrl+V Tab, or use spaces for indentation. Tab characters (or any other literal character) can always be inserted if prefixed by Ctrl+V.



Alternatively, if in Emacs command line editing mode (which I believe is the default in bash), use Ctrl+X Ctrl+E to bring up an editor to enter your command into. The editor used will be the one specified by the EDITOR shell/environment variable, or emacs if this variable is unset.



In Vi command line editing mode, press Escape v to do the same thing.



The command will be executed after saving and exiting the editor.






share|improve this answer














When you press Enter after entering an incomplete command, the bash shell will show a continuation prompt (the secondary prompt, $PS2) and allow you to complete the entered command. The command line editing facilities of the shell at that point is the same as at the original prompt (the primary prompt, $PS1), which means that the Tab key would do command and filename completion as usual.



To insert a tab character, use Ctrl+V Tab, or use spaces for indentation. Tab characters (or any other literal character) can always be inserted if prefixed by Ctrl+V.



Alternatively, if in Emacs command line editing mode (which I believe is the default in bash), use Ctrl+X Ctrl+E to bring up an editor to enter your command into. The editor used will be the one specified by the EDITOR shell/environment variable, or emacs if this variable is unset.



In Vi command line editing mode, press Escape v to do the same thing.



The command will be executed after saving and exiting the editor.







share|improve this answer














share|improve this answer



share|improve this answer








edited 2 mins ago

























answered 12 mins ago









Kusalananda

111k15216343




111k15216343











  • Could I ask What's vi command line, I am aware the Vim is a editor which should be opened in advance, go inside, and edit, rather than directly type into command and run.
    – avirate
    2 mins ago
















  • Could I ask What's vi command line, I am aware the Vim is a editor which should be opened in advance, go inside, and edit, rather than directly type into command and run.
    – avirate
    2 mins ago















Could I ask What's vi command line, I am aware the Vim is a editor which should be opened in advance, go inside, and edit, rather than directly type into command and run.
– avirate
2 mins ago




Could I ask What's vi command line, I am aware the Vim is a editor which should be opened in advance, go inside, and edit, rather than directly type into command and run.
– avirate
2 mins ago










avirate is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















avirate is a new contributor. Be nice, and check out our Code of Conduct.












avirate is a new contributor. Be nice, and check out our Code of Conduct.











avirate is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478231%2fwrite-structured-commands-in-multiple-lines-with-tab-key-activated%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

Confectionery