42shpimanmls / 42sh

Shell project at 42
3 stars 0 forks source link

History final #118

Closed lsimonne closed 7 years ago

lsimonne commented 7 years ago

Builtin:

Bang:

n0izn0iz commented 7 years ago

notre history est comme celui de bash c'est ça ?

lsimonne commented 7 years ago

oui

n0izn0iz commented 7 years ago

j'ai suis pas sur d'avoir compris la différence entre -a et -w

n0izn0iz commented 7 years ago

./42sh 2>errlog

[n0iz@nomad ~/Projects/42sh]$ qsdqsdqsd
[n0iz@nomad ~/Projects/42sh]$ history -p !!
history -p qsdqsdqsd
history -p qsdqsdqsd
qsdqsdqsd
[n0iz@nomad ~/Projects/42sh]$ 

sh (mon sh est un lien symbolique vers bash en mode posix)

sh-4.4$ qsdqsdqsd
sh: qsdqsdqsd: command not found
sh-4.4$ history -p !!
history -p qsdqsdqsd
qsdqsdqsd
sh-4.4$ 

ça imprime 2 fois la ligne dans le 42sh

lsimonne commented 7 years ago

-w écrase le fichier pour écrire l'history -a append à la fin du fichier les entrées pas encore écrites (par a ou w)

lsimonne commented 7 years ago
[ChezLouise@ ~/Documents/42/42sh]$ history -w file
  executing builtin history
  done executing builtin history, ok
[ChezLouise@ ~/Documents/42/42sh]$ cat file
one
two
three
four
five
un deux trois quatre cinq
history
history -w file
[ChezLouise@ ~/Documents/42/42sh]$ history -c
  executing builtin history
  done executing builtin history, ok
[ChezLouise@ ~/Documents/42/42sh]$ history -w file
  executing builtin history
  done executing builtin history, ok
[ChezLouise@ ~/Documents/42/42sh]$ cat file
history -w file
[ChezLouise@ ~/Documents/42/42sh]$
[ChezLouise@ ~/Documents/42/42sh]$ toto
42sh: toto: No such file or directory
[ChezLouise@ ~/Documents/42/42sh]$ titi
42sh: titi: No such file or directory
[ChezLouise@ ~/Documents/42/42sh]$ history -a file
  executing builtin history
  done executing builtin history, ok
[ChezLouise@ ~/Documents/42/42sh]$ cat file
history -w file
cat file
toto
titi
history -a file
[ChezLouise@ ~/Documents/42/42sh]$
n0izn0iz commented 7 years ago

sh

sh-4.4$ history -p !!
history -p un deux trois quatre cinq
un
deux
trois
quatre
cinq

42sh:

[n0iz@nomad ~/Projects/42sh]$ history -p !!
history -p un deux trois quatre cinq
  executing builtin history
  done executing builtin history, ok
lsimonne commented 7 years ago

ah oui merde c'était pour ça - ok faut que j'arrête de faire 10 choses en même temps, je regarderai ça demain !

n0izn0iz commented 7 years ago

Sinon tout le reste du builtin history a l'air ok, pas encore checké les substitution d'historique avancée.

n0izn0iz commented 7 years ago

c'est normal les event not found ?

[n0iz@nomad ~/Projects/42sh]$ history
  executing builtin history
1  one
2  two
3  three
4  four
5  five
6  un deux trois quatre cinq
7  history
8  history
  done executing builtin history, ok
[n0iz@nomad ~/Projects/42sh]$ history -p !one
history -p one  executing builtin history
one
  done executing builtin history, ok
[n0iz@nomad ~/Projects/42sh]$ history -p !fi
42sh: !fi: event not found
[n0iz@nomad ~/Projects/42sh]$ history -p !un
42sh: !un: event not found
[n0iz@nomad ~/Projects/42sh]$ history -p !t
42sh: !t: event not found
[n0iz@nomad ~/Projects/42sh]$ 
lsimonne commented 7 years ago

négatif. on it.

n0izn0iz commented 7 years ago
[n0iz@nomad ~/Projects/42sh]$ word bla
42sh: word: No such file or directory
[n0iz@nomad ~/Projects/42sh]$ history -p ^word^thing^
history -p word blaword^thing^
[n0iz@nomad ~/Projects/42sh]$ 

c'est pas sensé output :

history -p thing bla

?

n0izn0iz commented 7 years ago

go finir cette branche pour plus avoir de random travis fail (hopefully) @lsimonne

lsimonne commented 7 years ago

yes, je fix le problème que t'as soulevé (le fail de travis de execve c'est pas l'history!)

n0izn0iz commented 7 years ago

oui oui je sais pour execve mais comme ça ya pas de confusion