FjjDessoyCaraballo / minishell

This project aims to replicate bash shell
1 stars 3 forks source link

Redirections and absolute path commands #57

Closed FjjDessoyCaraballo closed 2 months ago

FjjDessoyCaraballo commented 2 months ago

UPDATE: Redirections and commands with absolute path are not working as intended.

Execution with redirections

The redirections are mainly following a simple syntax that the redirection is almost always followed by the file descriptor (fd). Therefore you will see < infile, > outfile, and >> outfile. The exception is heredoc, which is not creating a document per se, but it is writing directly to the STDIN.

USAGE:
%> echo test > infile
%> cat infile
test
%> rm outfile
rm: cannot remove 'outfile': No such file or directory
%> < infile cat | cat > outfile
%> cat outfile
test
%> echo test > infile
%> cat infile
test
%> echo test >> infile
%> cat infile
test
test
%> rm outfile
rm: cannot remove 'outfile': No such file or directory
%> << EOF cat  | cat > outfile
> test
> EOF
%> cat outfile
test

Executing with absolute path:

The commands with absolute paths are as simple as it comes. If you give the path to the binary, the command line will fetch and execute your binary.

USAGE:

The list continues, but it is safe to assume that you can derive your own tests out of the two examples that were given.