Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ "$action" == "set" ]
- then
- key=$2
- value=$3
- touch map.csv
- echo -e "$key,$value">>map.csv
- else
- targetKey=$1
- declare -A map
- while read line
- do
- IFS=',' read -a array <<<"$line"
- count=0
- for element in "${array[@]}"
- do
- rem=$(( $count % 2 ))
- if [ $rem -eq 0 ]
- then
- key=$element
- else
- value=$element
- map[$key]=$value
- fi
- count=$count+1
- done
- done < map.csv
- cd ${map[$targetKey]}
- exec bash
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement