Ah, you're trying to use sh-style syntax within a csh script.
It's not really possible to do on one line. You can use control expressions to sort of do what you want:
Here [ is a symlink to the external program "if" (using if might invoke csh's if). The && and || operate as logical operators; if the test returns a 0 result (is true), the && is executed and the || is short-cutted. However, if the test returns 1 (is false), the && is short-cutted, but the || takes over.
Compound commands within each branch can be done as well:
However, the parens probably create a subshell, meaning the environment may not be exactly the same, and of course, it will incur and OS cost. So be careful with this.
Hi,
This is a script which to create an opvn user, I want which answer automatically to a certain part so, I try this, it works without the red part but I must type manually.. :
#!/bin/bash
## Environnement ##
LC_ALL=C
## Paths ##
rsa_dir="etc/openvpn/easy-rsa"... (10 Replies)
Hello everybody,
I am coding a script, that allow the user to enter some information using prompt messages, i.e:
sEpisode=1
read -e -i "$sEpisode" -p "Start download from episode: " downloadFrom
sEpisode="${downloadFrom:-$sEpisode}"
This code allows the user to set the download from... (4 Replies)
Hi All
I have a script that moves files from one dir to another dir based on date, but I would like to change it in a way that whoever is going to run to enter the dates in which files will be removed. This is my script:
#!/bin/sh
touch -mt 201302250000 /tmp/ref3
touch -mt 201302282359... (14 Replies)
I have a script built that takes the standard inputs $1 $2 $3 after the name and parses some data.
hexsite=`echo "obase=16;$1"|bc`
hexfix=$(printf "%.3X" 0x$hexsite)
if || ;then
type=33
elif || ;then
type=59
elif ;then
type=99
else type=00
fi
cat /directory/*.2012$3*|
I am... (8 Replies)
Hello,
I am writing a script that requires the user to enter a string of numbers:
ex: 134 345 865 903
This command only allows for one variable to be entered:
set "var" = $<
and than once I got the array I want to change it to a list with each input on a different line:
... (1 Reply)
hi,
I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command
Here are my simple script
After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Dear All,
I hope you can help me.
I have a pair of E2900's I've inherited. Both running Solaris 9. Both have LOM> consoles. The problem I'm experiencing only occurs when connected to the /dev/console tty. Whenever I hit 'Enter' for a new line, I receive two new lines: -
myhost# ... (11 Replies)
Hey,
So I'm trying to write a program in unix to automate a process for my astrophysics research.
Basically I want the program to prompt the user for some information and store the entered string of text as a variable. I know how to do this.
This is where I need help:
Now lets say I have a... (4 Replies)
I'm using rsync with the "-e ssh" option so of course it asks for a password using a prompt. Is there a way to tell a script to expect a prompt, wait for it, and give a password when it arrives?
There is a way to give rsync a password as part of its options using a file, but it only works with... (2 Replies)
Hello guys...
I am having a doubt. Please try to rectify it. I would really appreciate it.
The thing is that is it possible to open any website say for example,google from the command line prompt(terminal) if you are working in Linux-fedora...
I am very new to Unix.
regards,
Mahesh... (2 Replies)