#! /bin/bash
declare -a dirs
i=1
for d in */
do
dirs[i++]="${d%/}"
done
echo "There are ${#dirs[@]} dirs in the current path"
for((i=1;i<=${#dirs[@]};i++))
do
echo $i "${dirs[i]}"
done
echo "which dir do you want?"
echo -n "> "
read i
echo "you selected ${dirs[$i]}"
Sunday, 21 June 2020
How do you store a list of directories into an array in Bash (and then print them out)?
Subscribe to:
Post Comments (Atom)
How to check if a file contains a specific string using Bash
In case if you want to check whether file does not contain a specific string, you can do it as follows. if ! grep -q SomeString "$File...
-
As the error states, you can only use .str with string columns, and you have a float64 . There won't be any commas in a float, s...
-
What ultimately worked for me was to check whether the shell was an interactive shell. I based the solution on this other post at unix.stack...
-
The simplest way is with pyperclip . Works in python 2 and 3. To install this library, use: pip install pyperclip Example usage: import ...
No comments:
Post a Comment