Alicia-bites / minishell

This project is about creating a simple shell.
1 stars 0 forks source link

Redirecting nothing to a file does not create file #44

Closed ggmolly closed 2 years ago

ggmolly commented 2 years ago

MINISHELL:

$: > a
$: cat a
/usr/bin/cat: a: No such file or directory

Expected behavior (bash)

bacon@omelet:~/goinfre/minishell$ > a
bacon@omelet:~/goinfre/minishell$ cat a
bacon@omelet:~/goinfre/minishell$ stat a
  File: a
  Size: 0           Blocks: 0          IO Block: 4096   regular empty file
Device: 10305h/66309d   Inode: 4733564     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/   bacon)   Gid: ( 1000/   bacon)
Access: 2022-08-17 16:23:37.025086948 +0200
Modify: 2022-08-17 16:23:36.597084320 +0200
Change: 2022-08-17 16:23:36.597084320 +0200
 Birth: 2022-08-17 16:23:36.597084320 +0200

Even though the file is empty, and is the result of a redirection of nothing, bash created the file a

BarrierAntho commented 2 years ago

STATUS:

Fixed

COMMIT:

8fdbf264ae7c067b72fed0f8b8778148a79915f5

MINISHELL;

$: > a
$: cat a
$: stat a
  File: a
  Size: 0           Blocks: 0          IO Block: 8192   regular empty file
Device: 37h/55d Inode: 324215575   Links: 1
Access: (0644/-rw-r--r--)  Uid: (40491/abarrier)   Gid: ( 4312/2021_paris)
Access: 2022-08-17 17:47:37.613878583 +0200
Modify: 2022-08-17 17:47:37.613878583 +0200
Change: 2022-08-17 17:47:37.613878583 +0200
 Birth: -
$: