For anyone have work in bash shell scripting before know the if and then statement
it work like this
if (condition); then
I have create a mini shell in C, and I want to make it a bit more tolerable than the normal bash shell where you do not need the ';' between if and then if they are in the same line so it will work like this
if(condition) then
And when the user write shell script x = 7 it will be the same with x=7. I have worked with shell scripting before and it drove me crazy where i miss a space.
Does anyone at least have the bash script so i can look at for some reference because i am kind of stuck.
There are reasons why a shell syntax works in an specific way, in this case
to force the use of ; (semi-colon) between two directives in the same line.
It is possible to change a language syntax rules, but you will always have
to pass your source code through your pre-processor before the script runs.
What if other people tried to maintain your code?
Will they keep it in your off syntax way?
After you get used to writing it in your way, what will happen if you go work
to another company that for sure will not have your pre-processor?
My experience, is that it is always best to learn the rules as they are.
Not try to change what has been already established by a group of high level thinkers.
Eventually, it will come to be very easy to you and you will make less and
less syntax mistakes.
Look at this line. What do you think it does?
It temporarily exports the http_proxy environment variable, setting it to hostname:3128, before running wget to retrieve a webpage. wget sees this variable and uses this proxy. Nothing else in the script sees the http_proxy variable change. It's a very handy ability considering how so many programs use environment vars like these.
You can also do
to prevent wget from seeing an http_proxy something else exported globally. A shell which allowed spaces after the = wouldn't ever be able to do this.
You might have heard of an attempt at creating a 'better shell' with a less shell-like syntax, called the C shell. It's one of the worst shells there is because of its poorly chosen syntax which was built on convenience, leaving many inconsistent parts, parsing bugs that are impossible to fix, and many basic features which the syntax didn't leave any way to add.
There really is a reason the shell does a lot of things the way it does.
Last edited by Corona688; 10-20-2011 at 05:47 PM..
rsync --delay-updates -F --compress --archive --rsh='/usr/bin/ssh -t -a -x' /web/admin/Transfer/data/ user1@destserver1:/tmp/testf
rsync version on sender server is:3.0.9
rsync version on sender server is:3.0.6
Linux sourceserver1 3.10.0-693.17.1.el7.x86_64 #1 SMP Sun Jan 14 10:36:03 EST... (1 Reply)
Hi, I have a HP UX C8000 box , have installed 11.11i from 4 x cds numerous times to try to get a functioning Network or to try and get rid of this error on start up, after new install and 1st startup I get an error
"The desktop messaging system could not be started" and then advice about... (12 Replies)
Hi Guys,
I`m having a strange problem with my data set. Whenever there is a transition to another value is col1, the corresponding 3rd col goes to the next line. This is a huge file, so need to fix in a script. The file is tab delimited.
Here is what is happening when transitioning from... (4 Replies)
Can you help me to fix my error please?! I checked the code and I think there is no mistake, but when I run it gives me error such
line 1: /Users/Manu/trials/hosts: is a directory
sort: open failed: /Users/Manu/trials/hosts/*: No such file or directory
Help me please...
mycode NAME value.... (9 Replies)
Hi,
I'm currently tinkering with a script that uses the for command to process all *.gif files in the current folder.
I marked the spot where it exits out with an error by adding a "pause"
The error message given is:
convert.exe: unable to open image `%x': No such file or directory @... (2 Replies)
Hi Team,
I am getting the following error when I do an errpt. What do I need to do to fix it.
LABEL: LVM_SA_STALEPP
IDENTIFIER: EAA3D429
Date/Time: Sat 12 Jan 01:10:56 2013
Sequence Number: 880
Machine Id: 00C57B904C00
Node Id: spg-lplaw-01... (1 Reply)
Pls help me with the below script.
Its returning an error No such file or Directory.
#!/bin/ksh
cd /enip/enipapp/cbp/AOC2511201
for file in `cat filename.txt | head -1 | tr -d '\r'`
do
for i in `cat '$file' | tr -d '\r'`
do
echo "-----script start `date`... (9 Replies)
I am getting a :; then
echo "Enter zero or one file"
echo "You must use a valid directory"
echo "Current directory is:" pwd
exit 0
fi
#Flag Variable
flag=1
#Code for no arguments
if ; then
for filename in *
do
if ; then
... (2 Replies)
I have a Sun Sparc machine with Solaris 9 on it. I changed one file system (also mount point) name from /home to /u01. Then I updated /etc/vfstab. After that, I did df -k, system told me that df: cannot statvfs /home: No such file or directory/.
Please tell me how and where to fix this error?... (2 Replies)
Patching a Solaris 2.6 server (running application that wasn't approved for anything higher) in single user mode - loading about 120 patches.
Following error started occurring after patch 105356-23
/kernel//kernel/strmod/ptem: undefined symbol miocpullup ptem error doing common
Actual... (0 Replies)