Liste des Groupes | Revenir à cu shell |
Note: this is just a question of aesthetics. Functionally, it all works asNot sure this really addresses your 'type funcName' query but maybe somewhat better output from 'type funcName' ? :
expected.
Sample bash code:
f="$(fortune)" # Get some multi-line output into "f"
# Look for foo followed by bar on the same line
[[ "$f" =~ foo[^$'\n']*bar ]] && echo "foo bar"
The point is you need the "anything other than a newline" or else it might
match foo on one line and bar on a later line. The above is the only way I
could figure out to express a newline in the particular flavor of reg exps
used by the =~ operator.
The problem is that if the above is in a function, when you list out the
function with "type funName", the \n has already been digested and
converted to a hard newline. This makes the listing look strange. I'd
rather see "\n".
Is there any way to get this?
Les messages affichés proviennent d'usenet.