Argv et tabulation

Argv et tabulation - C - Programmation

Marsh Posté le 22-02-2016 à 16:17:18    

Bonjour,
 
Je n'arrive pas à faire une tabulation dans le shell qui ne dois pas être interpréter comme le tab de l'auto-complétion.
 
./my_prof "abcdefg \t hijkl"
 
Comment vous y prenez-vous ?
 
Merci.

Reply

Marsh Posté le 22-02-2016 à 16:17:18   

Reply

Marsh Posté le 23-02-2016 à 13:16:16    

  • ANSI-quoted string: dans une chaîne entre $' et ', les caractères d'échappement ANSI C (genre \t) sont interprétés
  • "verbatim insert", selon le shell Control-V va insérer la touche suivante litéralement au lieu de l'interpréter.
  • printf %b


Donc

> ./my-prof $'foo\tbar'
Got 2 arguments
  ./my-prof
  foo bar


ou bien (foo [Control-V][Tab] bar)


> ./my-prof 'foo      bar'
Got 2 arguments
  ./my-prof
  foo bar


ou encore

> ./my-prof "$(printf %b 'foo\tbar')"
Got 2 arguments
  ./my-prof
  foo bar


Message édité par masklinn le 23-02-2016 à 13:18:42

---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box, and replicate and expand beyond their wildest dreams by throwing away the limits imposed by overbearing genetic r
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed