Inital commit
This commit is contained in:
20
Playground/testDetermineIfExists.sh
Normal file
20
Playground/testDetermineIfExists.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
ID=100
|
||||
#ID=$1
|
||||
VMS=$(qm list | tail -n+2 | awk '{print $1}')
|
||||
CTS=$(pct list | tail -n+2 | awk '{print $1}')
|
||||
EXISTINGIDS=(${CTS[@]} ${VMS[@]})
|
||||
|
||||
#for ExistingID in $(qm list | tail -n+2 | awk '{print $1}' &&pct list | tail -n+2 | awk '{print $1}'); do
|
||||
for ExistingID in "${EXISTINGIDS[@]}"; do
|
||||
echo $ExistingID
|
||||
if [ $ExistingID -eq $ID ]; then
|
||||
echo Exists
|
||||
IdExists=true
|
||||
break
|
||||
fi
|
||||
IdExists=false
|
||||
done
|
||||
if ! $IdExists; then echo "This ID does not exist"; exit; fi
|
||||
|
||||
echo end
|
||||
Reference in New Issue
Block a user