I am working on a BASHScript to start wlan monitor mode without interefering with NetworkManager and I am having trouble with this function:
serial_setup(){
local file_name=$1
while IFS =, read PhysicalDevice ItfAlias ItfMode;
do
iw $PhysicalDevice interface add $ItfAlias type $ItfMode
ifconfig $ItfAlias up
done < file_name
}
The above function reads a textfile in format:
PhysicalDevice1,alias1,mode1
PhysicalDevice2,alias2,mode2
PhysicalDevice3,alias3,mode3
I need to find out the cause of error and optimum solution?
EDIT: Here is the full code: MM Script I have to use paste`bin due to trouble pasting and formatting the code here
<text_file.txt>
and<command_to_activate _the_fuction>
IMHO: show us what you're actually typing and the actual error that occurs. FWIW it looks like you're trying to call a function from a script by passing its name as the first argument to the script - I'm not aware that that works (at least not in bash): either source your script so that the function becomes available in the current shell, or add a line to your script itself that calls the function with the script's first argument. – steeldriver Jan 31 '17 at 17:31