I am building an ftp wrapper that does some stuff before I spawn, I could easily do it in a shell script but wondering how I could do it in go
While exec.Command works for simple commands.
out, err := exec.Command("ls").Output() // Works
How do I wrap commands that are interactive e.g., ftp
out, err := exec.Command("ftp").Output()
It just exits. How do I deal with stdin ?
e.g., bash equivalent :
> ./t.sh
Welcome to myftp
ftp> open blahblah.com
> cat t.sh
#!/bin/bash
echo "Welcome to myftp "
#extra commands such as auth/authoriz.. etc.,
shift
echo "$@"
ftp
c++ equivalent :
int main() {
system("ftp");
return 0;
}