Open nunom4chado opened 1 year ago
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ export ls="ls| <<a |"
bash-3.2$ echo $ls
ls| <<a |
bash-3.2$ "$ls"
bash: ls| <<a |: command not found
bash-3.2$ $ls
bash: ls|: command not found
bash-3.2$ export ls="ls | <<a |"
bash-3.2$ echo $ls
ls | <<a |
bash-3.2$ "$ls"
bash: ls | <<a |: command not found
bash-3.2$ $ls
ls: <<a: No such file or directory
ls: |: No such file or directory
ls: |: No such file or directory
bash-3.2$ export ls="la"
bash-3.2$ ls $ls
ls: la: No such file or directory
bash-3.2$ export ls="-la"
bash-3.2$ ls $ls
total 1336
drwxr-xr-x+ 73 nuno staff 2336 Jun 22 01:32 .
drwxr-xr-x 5 root admin 160 Jul 14 2022 ..
-r-------- 1 nuno staff 7 Jun 26 2020 .CFUserTextEncoding
-rw-r--r--@ 1 nuno staff 18436 Jun 14 18:16 .DS_Store
drwxr-xr-x 8 nuno staff 256 Mar 27 21:33 .SynologyDrive
drwx------+ 5 nuno staff 160 Jun 14 13:20 .Trash
-rw------- 1 nuno staff 0 Jan 7 23:45 .Xauthority
drwxr-xr-x 11 nuno staff 352 Mar 1 2021 .android
-rw-r--r-- 1 nuno staff 57 Mar 16 2022 .angular-config.json
drwxr-xr-x 12 nuno staff 384 Aug 16 2021 .anydesk
drwxr-xr-x 4 nuno staff 128 Apr 9 2021 .app-store
-rw------- 1 nuno staff 17601 Jun 20 11:13 .bash_history
-rw-r--r-- 1 nuno staff 455 Dec 28 2021 .bash_profile
drwx------ 111 nuno staff 3552 Jan 27 2022 .bash_sessions
drwxr-xr-x 4 nuno staff 128 Jan 26 21:19 .cache
drwxr-xr-x 3 nuno staff 96 Oct 7 2022 .cocoapods
drwxr-xr-x 8 nuno staff 256 Oct 12 2021 .composer
drwx------ 11 nuno staff 352 Jan 26 21:18 .config
drwxr-xr-x 10 nuno staff 320 Jan 28 2022 .docker
drwxr-xr-x 3 nuno staff 96 Sep 8 2021 .electron-gyp
-rw------- 1 nuno staff 16 Nov 25 2020 .emulator_console_auth_token
drwxr-xr-x 13 nuno staff 416 Oct 7 2022 .expo
drwxr-xr-x 4 nuno staff 128 Oct 7 2022 .gem
-rw-r--r-- 1 nuno staff 88 Jun 10 2021 .gitconfig
-rw------- 1 nuno staff 20 Apr 17 11:54 .lesshst
drwxr-x--- 3 nuno staff 96 Nov 18 2022 .lldb
drwx------ 4 nuno staff 128 Jan 26 21:16 .local
-rw------- 1 nuno staff 101 Jun 2 2022 .netrc
drwxr-xr-x 4 nuno staff 128 Dec 28 2021 .node-gyp
-rw------- 1 nuno staff 16 Jan 27 2022 .node_repl_history
drwxr-xr-x 15 nuno staff 480 Apr 22 2022 .npm
drwxr-xr-x 31 nuno staff 992 Dec 28 2021 .nvm
drwxr-xr-x 22 nuno staff 704 May 16 2022 .oh-my-zsh
drwxr-xr-x 9 nuno staff 288 Aug 28 2020 .parsec
drwx------@ 6 nuno staff 192 Aug 8 2022 .pgadmin
drwxr-xr-x 273 nuno staff 8736 Mar 15 10:53 .phpls
drwxr-xr-x 4 nuno staff 128 Aug 29 2022 .plastic4
-rw------- 1 nuno staff 13 Apr 1 2021 .psql_history
drwx------ 4 nuno staff 128 Oct 21 2021 .putty
-rw------- 1 nuno staff 10 Dec 6 2022 .python_history
drwxr-xr-x 3 nuno staff 96 Nov 25 2020 .react-native-cli
-rw-r--r-- 1 nuno staff 1972 Dec 1 2020 .rndebuggerrc
-rw-r--r-- 1 nuno staff 10 Jan 27 2022 .shell.pre-oh-my-zsh
drwx------ 6 nuno staff 192 Mar 27 16:25 .ssh
drwxr-xr-x 5 nuno staff 160 Jan 7 18:29 .swiftpm
-rw------- 1 nuno staff 12288 Aug 8 2022 .swp
drwxr-xr-x 3 nuno staff 96 Feb 20 10:59 .th-client
drwxr-xr-x 5 nuno staff 160 Jan 26 11:09 .vim
-rw------- 1 nuno staff 20938 Feb 21 19:30 .viminfo
-rw-r--r-- 1 nuno staff 234 Jan 26 11:08 .vimrc
drwxr-xr-x 4 nuno staff 128 Jul 6 2020 .vscode
drwxr-xr-x 3 nuno staff 96 Nov 25 2020 .vscode-react-native
-rw-r--r-- 1 nuno staff 48141 Jul 12 2022 .zcompdump-Nuno’s MacBook Pro-5.8
-rw-r--r-- 1 nuno staff 48145 Aug 8 2022 .zcompdump-Nuno’s MacBook Pro-5.8.1
-rw------- 1 nuno staff 315421 Jun 15 01:00 .zsh_history
drwx------ 19 nuno staff 608 Nov 5 2022 .zsh_sessions
-rw-r--r--@ 1 nuno staff 4050 Dec 19 2022 .zshrc
drwx------@ 5 nuno staff 160 Oct 26 2020 Applications
drwx------@ 10 nuno staff 320 Jun 14 13:20 Desktop
drwx------@ 15 nuno staff 480 Apr 5 15:44 Documents
drwx------@ 28 nuno staff 896 Jun 13 22:15 Downloads
drwx------@ 98 nuno staff 3136 Dec 2 2022 Library
drwxr-xr-x 5 nuno staff 160 Dec 20 2021 Local Sites
drwx------+ 7 nuno staff 224 Jun 9 2022 Movies
drwx------+ 8 nuno staff 256 May 17 2022 Music
drwx------+ 9 nuno staff 288 Aug 8 2022 Pictures
drwxr-xr-x 3 nuno staff 96 Jul 8 2020 Postman
drwxr-xr-x+ 5 nuno staff 160 Jul 27 2020 Public
drwxr-xr-x@ 9 nuno staff 288 Mar 27 21:33 SynologyDrive
drwxr-xr-x 4 nuno staff 128 Dec 14 2022 VirtualBox VMs
drwxr-xr-x 21 nuno staff 672 Jan 26 21:08 francinette
drwxr-xr-x 9 nuno staff 288 Aug 29 2022 lego_microgame
-rw-r--r--@ 1 nuno staff 127024 Jan 27 2022 vs_code_dark_plus.terminal
bash-3.2$ export ls="-la | echo ola"
bash-3.2$ ls $ls
ls: echo: No such file or directory
ls: ola: No such file or directory
ls: |: No such file or directory
bash-3.2$ export ls="ls | echo ola"
bash-3.2$ ls $ls
ls: echo: No such file or directory
ls: ls: No such file or directory
ls: ola: No such file or directory
ls: |: No such file or directory
bash-3.2$ export ls="l"
bash-3.2$ $lss
bash-3.2$ "$ls"s
Applications Pictures
Desktop Postman
Documents Public
Downloads SynologyDrive
Library VirtualBox VMs
Local Sites francinette
Movies lego_microgame
Music vs_code_dark_plus.terminal
bash-3.2$ export ls="l "
bash-3.2$ "$ls"s
bash: l s: command not found
bash-3.2$ cat
jn
jn
kjn
kjn
kl
kl
^C
bash-3.2$ tee
jk
jk
jk
jk
bash-3.2$ ls
Applications Pictures
Desktop Postman
Documents Public
Downloads SynologyDrive
Library VirtualBox VMs
Local Sites francinette
Movies lego_microgame
Music vs_code_dark_plus.terminal
bash-3.2$ cp
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-aclpsvXx] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-aclpsvXx] source_file ... target_directory
bash-3.2$ echo file1 >
bash: syntax error near unexpected token `newline'
bash-3.2$ echo "content file1" > file1
bash-3.2$ echo "content file2" > file2
bash-3.2$ ls
Applications Postman
Desktop Public
Documents SynologyDrive
Downloads VirtualBox VMs
Library file1
Local Sites file2
Movies francinette
Music lego_microgame
Pictures vs_code_dark_plus.terminal
bash-3.2$ cat
file1
file1
file2
file2
bash-3.2$ ls
Applications Postman
Desktop Public
Documents SynologyDrive
Downloads VirtualBox VMs
Library file1
Local Sites file2
Movies francinette
Music lego_microgame
Pictures vs_code_dark_plus.terminal
bash-3.2$ << ola
> kb
> bash-3.2$ cat << a
> im a heredoc
> asdf asdf
>
> sdg
> dg
> im a heredoc
asdf asdf
sdg
dg
bash-3.2$ bash 2> erros.txt
^C
bash-3.2$ ls
Applications Public
Desktop SynologyDrive
Documents VirtualBox VMs
Downloads erros.txt
Library file1
Local Sites file2
Movies francinette
Music lego_microgame
Pictures vs_code_dark_plus.terminal
Postman
bash-3.2$ cat file1 > /dev/null
bash-3.2$ tty
/dev/ttys004
bash-3.2$ cat /dev/ttys005
ola
adeus
file1
^C
bash-3.2$ cat ola > /dev/ttys005
cat: ola: No such file or directory
bash-3.2$ cat file1 > /dev/ttys005
bash-3.2$ tty
/dev/ttys005
bash-3.2$ cat
^C
bash-3.2$ content file1
Check if env and export variables pass to another instance of minishell
Also, make sure extracting a variable value works without quotes, with single quotes and double quotes
cd Desktop/\$HOME/
numartin@c1r8s17:~$ export banana=fruta
numartin@c1r8s17:~$ echo $banana
fruta
numartin@c1r8s17:~$ export $banana=comida
numartin@c1r8s17:~$ echo $fruta
comida
numartin@c1r8s17:~$
echo $7asdfsasdf output: asdfsasdf
numartin@c1r8s17:~$ export sequence="echo ola | wc"
numartin@c1r8s17:~$ $sequence
ola | wc
numartin@c1r8s17:~$ export LS="ls -la | wc"
numartin@c1r8s17:~$ echo $LS
ls -la | wc
numartin@c1r8s17:~$ $LS
ls: cannot access '|': No such file or directory
ls: cannot access 'wc': No such file or directory
numartin@c1r8s17:~$ export LS="a=4 ls"
numartin@c1r8s17:~$ $LS
a=4: command not found
numartin@c1r8s17:~$
numartin@c1r8s17:~/Desktop$ export LS="ls "
numartin@c1r8s17:~/Desktop$ $LS"-la"
cat <<a > file.txt | cat <<b
check if file.txt exists check if file.txt has the contents of the first heredoc
unset $PWD
- should display:
bash: unset: `/nfs/homes/numartin': not a valid identifier
cat file1.txt > file2.txt > file3.txt Should rewrite the content of test1.txt to test3.txt and erase content of test2.txt
Expand
if the first word is in double quote
history
Only with HISTCONTROL=ignoreboth (https://unix.stackexchange.com/questions/115917/why-is-bash-not-storing-commands-that-start-with-spaces)
EXEC
cat
should display blank prompt as print the lines entered. ctr-c exitsOthers
OLD
parsing
echo ola>test.txt
- must create a file with olaecho 'ola>test.txt'
- just print textecho "ola>test.txt"
- just print textecho ola |
- must prompt again to add to the commandecho ola >
- syntax errorecho ola >>
- syntax errorecho ola <
- syntax errorecho ola <<
- syntax error