From aebf4de1a36b1a0c8d86d7b1731b7096aaf1eed5 Mon Sep 17 00:00:00 2001 From: Filip Borum Poulsen Date: Tue, 9 Apr 2024 20:51:22 +0200 Subject: [PATCH] FIX --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 82ea937..d1d491b 100644 --- a/README.md +++ b/README.md @@ -38,26 +38,26 @@ #!/bin/bash # Print the ip address of the raspberry pi - current_ip=$(hostname -I | cut -d' ' -f1) + current_ip=\$(hostname -I | cut -d' ' -f1) # Print the ip address - echo "The current ip address is $current_ip" + echo "The current ip address is \$current_ip" # Ask if they want to change the ip address echo -n "Do you want to change the ip address? (Y/n) " read change_ip # Exit if they don't want to change the ip address - if [ "$change_ip" = "n" ]; then + if [ "\$change_ip" = "n" ]; then exit 0 fi # Ask if they want to use dhcp echo -n "Do you want to use dhcp? (y/N) " read use_dhcp - if [ "$use_dhcp" = "y" ]; then + if [ "\$use_dhcp" = "y" ]; then # Set the ip address to dhcp - sudo nmcli device modify eth0 ipv4.method auto + sudo nmcli c modify "Wired connection 1" ipv4.method auto ipv4.addresses "" ipv4.gateway "" # Restart the network sudo nmcli c down "Wired connection 1" @@ -72,20 +72,20 @@ # Ask for the new subnet mask echo -n "Enter the new CIDR subnet mask (press enter for default of 24) " read subnet_mask - if [ -z "$subnet_mask" ]; then + if [ -z "\$subnet_mask" ]; then subnet_mask="24" fi # Ask for the new gateway echo -n "Enter the new gateway (press enter for default of 192.168.25.1) " read gateway - if [ -z "$gateway" ]; then + if [ -z "\$gateway" ]; then gateway="192.168.25.1" fi # Set the new ip address - sudo nmcli c mod "Wired connection 1" ipv4.addresses $new_ip/$subnet_mask ipv4.method manual - sudo nmcli c mod "Wired connection 1" ipv4.gateway $gateway + sudo nmcli c mod "Wired connection 1" ipv4.addresses \$new_ip/\$subnet_mask ipv4.method manual + sudo nmcli c mod "Wired connection 1" ipv4.gateway \$gateway # Restart the network sudo nmcli c down "Wired connection 1" @@ -104,6 +104,8 @@ ```bash sudo useradd ip --shell /ip.sh -p ip --create-home + echo -e "ip\nip" | sudo passwd ip + ``` 1. Silence the login message