Ubuntu :: Bash If/then Conditional Syntax?

Feb 7, 2011

I pride myself on at least trying to help myself before I ask, but I've been staring at this a long time, I'm just not getting any traction.I've literally got 3 linux references on my desk right now that say that I should be able to use if conditionals, for example

[ -d FILE ]True if FILE exists and is a directory.
[ -e FILE ]True if FILE exists.
[ -f FILE ]True if FILE exists and is a regular file.

[code]....

View 7 Replies


ADVERTISEMENT

General :: BASH Script Alphabetical Conditional Operator Query?

Mar 14, 2010

I am using "if" to force a word under the condition that the first letter of that word must be a letter of the alphabet, regardless of capitalization, using the " "" != "" " syntax.

Like so:

Code:
if [[ "$interface" != "WHAT DO I PUT HERE?" ]] ; then
echo "Invalid input"
exit 1
fi

View 5 Replies View Related

General :: SUSE 10 Syslog-ng Syntax - Bash: Syntax Error Near Unexpected Token "("

Apr 20, 2011

I am a Novell (now defunct) CNE tring to learn Linux and am having a lot of trouble finding out where the WB 6-6 is wrong in the syntax for adding local4... the the syslog-ng config file. In the instructions there are discrepancies between commas and simi-comma, they are both in the statements in no particular order. there is no pattern to them. Here is what the book shows:

filter f_local4debug { level(debug) and facility(local4); };

When I try to input this in the Gnome terminal window to try and find out where it goes wrong I get the following: -bash: syntax error near unexpected token "(" If I can get the correct syntax I belive I can use the info to get past the rest of this portion of the lesson. I am desperate to learn Linux as the only jobs out there for a Novell CNE are migrations to MS, which really sucks, since MS really really sucks.

View 1 Replies View Related

Ubuntu :: Bash Script Syntax Different For (Lucid)?

Feb 17, 2011

In a bash script brought over from a Debian/Lenny system, Ubuntu 10.04 stumbles on the left parenthesis in the expression below:NEED_COLS=$[($HEX_WIDTH * 4) + 12]Is it an Ubuntu/Debian script style mismatch, or just post-Lenny? If that can be answered, is there a way to reconcile or syntax check older scripts?

View 2 Replies View Related

Programming :: Bash Syntax To Translate From Csh Scripts?

Jan 1, 2011

I am setting some environmental variable in my .bashrc , the sample code I was provided with is for CSH but I am using bash, and there are some syntax differences between them ... I got most of the script to work, but I am getting an error at this part :

Code: if ($RMSTREE == $RMANTREE) then
set path=($path $RMANTREE/bin)
else

[code]...

View 2 Replies View Related

Ubuntu :: Bash: Syntax Error Near Unexpected Token `(' \ When Want To Share A Folder?

May 16, 2010

I install nfs-common,nfs-kernel-serverNow I can not use

PHP Code:
# home 192.168.1.10(ro,no_root_squash) 
I get
Quote:
bash: syntax error near unexpected token `('

when I want to share a folder

View 2 Replies View Related

Programming :: Bash Syntax \ See 1 If The Exit Value Of Diff Is 0, And Otherwise Wanna See 0?

Dec 26, 2010

I'm new to scripting and I have a trouble with if statement syntax. The code is: Code: #there is a diff command here, and it does what i want but#i wanna see 1 if the exit value of diff is 0, and otherwise i wanna see 0.#the problem is here: (syntax error near unexpected token "then")

if["$?"==0];
then
echo 1

[code].....

View 1 Replies View Related

Programming :: Bash Script Cannot Run Functions - No Syntax Errors

Apr 23, 2011

I have this project which I've been working on essentially nonstop for the past three days and due to work I am running low on time. I'm new to Linux/Unix and my Teacher has assigned us a scripting project, due for Monday. I have All the functions for the project in a separate file which run as a daemon process when I log in. It has no syntax errors but my Script can not run the functions (I'm not sure where they go before or after the body) and I have one function I'd like you guys to take a look at. It has a Second menu leading to a case statement but it does not run after the Search. I'm Kinda tired of looking at the CLI but I have to finish this.

phoneEdi() {
directory=~/phonepro/directory
loop="y"
clear
tput cup 4 4; echo "Record Editor" .....

View 1 Replies View Related

General :: Bash Script Syntax Fail As Root?

Apr 12, 2011

I'm scratching my head over a very simple netcat-based heartbeat monitoring script i wrote.

here we go:
Code:
echo `date --utc "+%Y-%m-%d %H:%M:%SZ"` script started

[code]...

View 6 Replies View Related

General :: Bash - Syntax Error Near Unexpected Token `('

May 2, 2010

I am trying to install vlc media player on my backtrack3 but when i am giving a command xvjf to extract bz2 file then

bash: syntax error near unexpected token `('

View 1 Replies View Related

Software :: Bash Script Syntax (Get Existing Directory)

Sep 10, 2009

I'm starting to learn bash scripting and I can't figure out what's wrong with the following.

Code:
#!/bin/bash -x
ALFA=`kdesu "kdialog --getexistingdirectory ."`
echo $ALFA

View 9 Replies View Related

Programming :: Bash - Syntax For ((<arithmetic Expression>)) Usage ?

Mar 18, 2010

I do not understand bash' syntax regarding the use of ((<arithmetic expression>)). $((<arithmetic expression>)) is tokenised to a single word. OK.

Code:

In isolation

Code:

It may not be used where a word is expected. This generates a syntax error. Why?

Code:

View 6 Replies View Related

Ubuntu :: Run A Bash Script - Failing Miserably: Syntax Error Near Unexpected Token

Dec 18, 2010

I thought I'd make myself a bash script of sorts to download movie trailers, from a file where I manually dump the URL of each file on a separate line: file 'trailerlist':

[Code]...

View 7 Replies View Related

General :: (small) Bash Script - Catching Syntax Errors

Sep 9, 2010

I've been trying to find a bug in this test script, but haven't been able to so far. I'm not lazy, I promise...just new to Bash so am having a hard time catching syntax errors. I call the script with the option -disableVenusBld, and it still prints "Starting build", which it shouldn't be doing right?

[Code]...

View 1 Replies View Related

General :: Custom Syntax Highlighting In Bash Shell - Using Keywords

Apr 25, 2011

I know it's possible to change the $ user@hostname colors, but is it possible to color different things? Could I make all numbers/integers a certain color. Or set certain keywords to be bold?

View 1 Replies View Related

General :: Bash Shell Syntax For Opening A Text Editor?

Apr 28, 2011

I'm trying to be able to Open a text editor without needing an existing file.This is my code:

case $ans in
"Show Today") echo "$(date)";;
"Show Calendar") cal;;

[code]...

View 14 Replies View Related

Software :: Bash Syntax - While Loop With Multiple Comparison Operators

Apr 21, 2009

I'm trying to code the following WHILE loop in Bash:
While [string1 is non zero] and [string2 is non zero] and [counter < max]
Do
...
Done

I can't get the syntax right. I've tried:
Code:
while [ -n "$STRING1"] -a [ -n "$STRING2"] -a [$COUNTER -lt $MAX ]
But I get 'Too may arguments'

View 4 Replies View Related

Programming :: Bash Daemon Encounters Syntax Error After Midnight?

Feb 24, 2011

I have a daemon script which wakes up every 5 minutes and checks the health of started processes. It works fine during the day but throws a syntax error just after midnight.Here is the log:

(02/22-23:49) Check all started processes
(02/22-23:54) Check all started processes
(02/22-23:59) Check all started processes

[code]....

View 9 Replies View Related

Programming :: Bash Script Giving Unexpected End Of File - Syntax Error

Apr 12, 2010

I have a bash script giving me the following error:

[Code]...

When I run it I am getting: ./svnup: line 61: syntax error: unexpected end of file Can't for the life of me figure out what is wrong. It's a script to export the latest revision from SVN to the web root folder and archive the previous version, basically.

View 4 Replies View Related

Programming :: Run Small Shell Script - Bash - Syntax Error Near Unexpected Token `('

Jul 9, 2010

I was trying to run small shell script, but could not run. I got the error like in subject.

This is exact way i was trying to do.

View 6 Replies View Related

Software :: Dpkg - Add / Remove Package Won't Work - Terminal Goes: Bash Syntax Error Near Unexpected Token `newline'

Mar 11, 2010

When I am adding removing packages to get more hard drive space, this is not the first time I left too many pages open and it crashes on me. My son would fix it by typing in the terminal sudo something, but I want to know how to do this. The only thing not working is the add/remove packages at the moment. Here is what it said, E:dpkg was interrupted you must manually run 'dpkg--configure -a' to correct the problem E: _cache-open()failed please report. Please, could someone tell me how to get the default back or whatever. When I type in the terminal, it refused my password until I tried several times, plus, it finally says in the terminal No such command. Bash. No such command. I am hoping this question is one you do recognize the answer for.

I tried using Yum to remove the package. Like this:

To remove or uninstall a package:

Code:

yum -y remove ,package name>

Terminal goes: Bash syntax error near unexpected token `newline'

View 3 Replies View Related

Ubuntu :: Create New Directory But Keep Getting Same Error - Bash: Syntax Error Near Unexpected Token `newline'

Jan 13, 2010

I'm trying to create a new directory using the mkdir command.

Code:

home@ubuntu:~$ mkdir <aicoursework>
bash: syntax error near unexpected token `newline'

that's the error that i keep getting, what am i doing wrong?

View 5 Replies View Related

Ubuntu :: ERROR --bash: Syntax Error Near Unexpected Token 2

Feb 4, 2010

The following problem occurs to me, I'm creating a distribution (as a class project) for my school (I'm studying telecommunications and computer systems). I am following, in order to create the distribution, the manual that you can find on this page: [URL] But when I get to write:

[Code]...

View 3 Replies View Related

General :: Can't Open File/abcd/configFiles/vim/syntax/syntax.vim?

Mar 7, 2011

When ever i open vim, i get the error that the following error: E484: Can't open file/abcd/configFiles/vim/syntax/syntax.vim There was a .vimrc file in my home folder that i have removed.

Still i keep getting the same error. Presently in my home folder there is no .gvimrc or .vimrc file.

But still i keep getting the same error. I am not too sure where this file is mentioned.

Background info: The SHELL has been changed from tcsh to bash Earlier i had created a .vimrc file in tcsh, i have removed the .vimrc in bash SHELL.

View 1 Replies View Related

General :: Bash Error - Syntax Error Near Unexpected Token `{

Mar 4, 2010

I am new to shell scripting, bash specifically.

I am trying to run the following script:

Code:

When trying to execute I always get this error:

Code:

In case you need to know the permissions. Here is it:

Code:

I run the script using the following command:

Code:

View 1 Replies View Related

Software :: Conditional Operator In C?

Feb 24, 2010

if anyone knows plz explain this conditional operator timeout ? : MAX SCHEDULE_TIMEOUT

View 2 Replies View Related

Server :: Conditional (on Ip Address) /etc/issue.net Possible?

May 27, 2010

I'm running Debian with openssh 1:5.1p1-5 and I've got an operational and legal /etc/issue.net but I'd like to make it depend on the incoming IP address. To be more specific, I'd like to achieve that no banner is shown when logging in from my company's IP range(s) or when logging in from home, but any unknown address (potential intruder) should be confronted with our legal warning.Is this at all possible?The server is located off-site and only has one ethernet device active (i.e. I cannot say eth0 is external, eth1 is internal)

View 3 Replies View Related

Software :: Makefile Conditional Does Not Work?

Jan 29, 2010

I'm trying to write a make file to deploy software in a production setup.

The first thing I'm trying to do is detect if the user running the make is root.

From the documentation scattered about, I came up with this:

Code:

USERID=$(shell id -u)
all:
$(info User Id is $(USERID))
ifeq ($(REQUIRED_USER),0)
$(info Running as root... OK)

[Code]....

As you can see, in both situations, make executes both branches of the conditional.

View 6 Replies View Related

Programming :: Conditional Foreach Loop In Perl?

Jun 1, 2010

#!/usr/bin/perl -w
use strict;
my @files = `ls -1`;

[code]...

View 2 Replies View Related

CentOS 5 :: Application Hangs In Conditional Wait?

Dec 18, 2009

I am facing the following issue. My application runs perfectly in red hat linux(32bit, 64bit physical m/c and 32 bit vmWare m/c) and in one version of centOS(32bit physical m/c - don't remember the version:Sorry). However when I am running the same application in CentOS 5.4 (64bit version) I face the following issues -

a. the application gets stuck in the conditional wait even though the signal is sent after the application has moved to conditional wait. b. vsftpd service start fails from within the application even though the service starts and stops peroperly from console.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved