If it has to be pure csh (without any helpers), you're probably out of luck,
because csh is crippled when it comes to scripting.
You could probably use a command substitution on a one-liner of your bash from
the csh script:
#! /bin/csh
set myvar=`bash -c 'read -t 10 ;echo "${REPLY}"'`
echo "$myvar"
For anything much trickier, getting the quoting right will be a killer, so the
helper should probably be a separate bash script.
Picking csh to script it is just wrong, because it has too many missing
capabilities, isn't predictable enough in how it behaves, doesn't necessarily
behave as portably as other shells, etc.
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
<http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/>
> On Mar 8, 2021, at 04:38, Thebest videos <[email protected]> wrote:
>
>
> hi Team,
>
> Im trying create a csh script.
> requirement:
> when i script runs it asks for user input. prompt should wait for 10secs.
> if not then exit the script.
> i have solution for bash script where i can use read -t 10 username. but i
> want same in csh
> ```
> #!/bin/csh
> echo -n "username:"
> set req = $<
> echo "username is $req"
> sed -i.bak "/rootpw/s/edjos/$req/" /boot/loader.conf
> ```
> and for advance level, the message should look like "prompts end in 10(this
> number should decrease and lively should visible the timeout secs)"
> _______________________________________________
> openindiana-discuss mailing list
> [email protected]
> https://openindiana.org/mailman/listinfo/openindiana-discuss
>
_______________________________________________
openindiana-discuss mailing list
[email protected]
https://openindiana.org/mailman/listinfo/openindiana-discuss