Listing my StackEchange communities user id
I see 2 errors and have some more advice.
The Shebang is wrong.
#!/bash/bin
should be
#!/bin/bash

Do not put comment after the \ escape for a new line
| cut -d&quot;/&quot; -f3,5 \ # stackoverflow.com/3581081
# should be
| cut -d&quot;/&quot; -f3,5 \

I would move all functions (in your case only parse()) to the top of the file.
Use lowercase variables (uppercase is reserved for system variables like PATH).
NETWORK_PROFILE_URL=
# change to
network_profile_url=

Combine cut and sed
read -r ID USER &lt;&lt;&lt; \
    $( cut -d'/' -f5,6 &lt;&lt;&lt; $NETWORK_PROFILE_URL \
        | sed 's/\// /g' \
    )
# can be replaced by
read -r ID USER &lt; &lt;(awk -F &quot;/&quot; '{print $(NF-1) &quot; &quot; $NF }' &lt;&lt;&lt; $NETWORK_PROFILE_URL)
# which is easier to read then
source &lt;(sed -r 's#.*/(.*)/(.*)#ID=\1; USER=\2#' &lt;&lt;&lt; $NETWORK_PROFILE_URL)

When you end a line with a pipe, you do not need to escape the newline with \.
curl &quot;https://stackexchange.com/users/$ID/$USER?tab=accounts&quot; \
    | grep &quot;account-container&quot; -A1 \
    | grep &quot;http&quot; \
    | cut -d&quot;/&quot; -f3,5 \
    | parse 
# can be changed into
curl &quot;https://stackexchange.com/users/$ID/$USER?tab=accounts&quot; |
    grep &quot;account-container&quot; -A1 |
    grep &quot;http&quot; |
    cut -d&quot;/&quot; -f3,5 |
    parse 

You had a hard job parsing the curl output with different tools. In this situation you won't need to parse large files, the performancy penalty is very small. It is worth the effort for other cases to look for a solution with awk.
The grep -A1 is replaced by setting a flag for parsing the next line.
Fields are found with the delimiter '/'.
Combining substr is only slightly more complex:
curl -s &quot;https://stackexchange.com/users/$ID/$USER?tab=accounts&quot; |
   awk -F &quot;[/]&quot; '
      parse==1 {
         print substr($3,1,index($3,&quot;.&quot;)-1) &quot;:&quot;;
         printf(&quot;  url: https://%s\n&quot;, $3);
         printf(&quot;  id: %s\n&quot;, $5);
         parse=0;
      }
      /account-container/ {parse=1}
    '