17 lines
488 B
Bash
Executable File
17 lines
488 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# it's important to put the input_string inside single quotes
|
|
input_string='#include <stdio.h>%[\r]#define PRINT %[\s]%[\r]#define FT(...) int main(){%[\\]%[\r]'
|
|
|
|
special_cahracters=$(echo -E "$input_string" | grep -o "%\[..\]")
|
|
echo $special_cahracters
|
|
|
|
# assiocative array : https://www.gnu.org/software/bash/manual/html_node/Arrays.html
|
|
declare -A instructions
|
|
instructions["%[\r]"]=10
|
|
instructions["%[\s]"]="S"
|
|
instructions["%[\\]"]=92
|
|
instructions["%[\"]"]=34
|
|
|
|
for key
|