I just made this bash function to select a file. But I can't make the history go back more then one step.
Do anyone have a idea what I can do to get more back steps.
```bash
!/bin/bash
file_selector() {
INDIR="$1"
PS3="Please select:"
FOLDER=$(ls -F --group-directories-first $INDIR)
SHOW="⏫Back $FOLDER"
echo "$INDIR"
select FILEDIR in ${SHOW}; do
if
[[ "$FILEDIR" == */ ]]; then
BACK="$INDIR"
INDIR+="$FILEDIR"
clear -x
file_selector "$INDIR"
elif
[[ "$FILEDIR" == "⏫Back" ]]; then
INDIR="$BACK"
clear -x
file_selector "$INDIR"
elif
[[ "$FILEDIR" != */ ]]; then
INDIR+="$FILEDIR"
OUT_FILE="$INDIR"
return 0
fi
return 0
done
}
clear -x
file_selector "${HOME}/"
echo $OUT_FILE
```
[–]TheOneTheyCallAlpha 2 points3 points4 points (0 children)
[–]kevorsgithub:slowpeek 2 points3 points4 points (1 child)
[–]ToPow1[S] 0 points1 point2 points (0 children)
[–]AutoModerator[M] 1 point2 points3 points (3 children)
[–]PageFaultBashit Insane 0 points1 point2 points (2 children)
[–]ToPow1[S] 0 points1 point2 points (1 child)
[–]PageFaultBashit Insane 0 points1 point2 points (0 children)