![]() ![]() ![]() Now Ctrl+ x, Ctrl+ w handles quoting, inserts watch automatically and places the cursor in the right position for you to type options. The following works in Bash 4.4.20: _quote_all() The contents of the Readline line buffer, for use with bind -x. The expansion is a string that is the value of parameter quoted in a format that can be reused as input. Relevant parts of expansion is either a transformation of the value of parameter or information about parameter itself, depending on the value of operator. My idea is to call a shell function (upon a keystroke) that will manipulate READLINE_LINE using the feature. (Note: the question arose when I was answering this one.) embrace the whole resulting string with single-quotes īut it's tedious and error-prone to do this by hand.Ĭan I make Bash properly add one level of single-quoting/escaping to the entire command line on demand?.replace every ' with '"'"' or with '\'',.I think I know the right general solution: In general the command can include single-quotes, so just embracing with single-quotes blindly is not a solution. Quote and/or escape the original command. Add watch (or whatever) at the beginning.In case of ssh it means it should occur on the server. ![]() In case of watch it means all the expansion and interpretation should occur later, periodically. Nothing in the command should be expanded or interpreted before it gets to watch or similar tool. The command is obtained from history or pasted into the command line or typed as if it's going to be executed directly it's in my command line verbatim. I already have the exact command I want to provide to watch or ssh, or similar tool. In fact watch (or ssh) builds this single argument for sh -c or similar command. It depends on quoting/escaping if the local shell interprets $variable, | and such, or the remote shell.Īnd there are commands like sh -c which require a single argument containing code, but the need for quoting/escaping is similar. Ssh is similar, it can take one or more arguments and built a command to be run on the server. These two commands are different: watch echo "$$" If the command is more complicated, it's all about quoting/escaping if things like $variable, *, |, or & are interpreted by the current shell or get to watch. Consider a tool like watch that can take another command (e.g. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |