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
ADVERTISEMENT
Feb 24, 2010
if anyone knows plz explain this conditional operator timeout ? : MAX SCHEDULE_TIMEOUT
View 2 Replies
View Related
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
View Related
Oct 21, 2010
I am trying to write a bash script that will extract a .cbr (.rar) file, traverse the extracted files in alphabetical order and rename them 001.JPG, 002.JPG, 003.JPG, etc.So far I only have this much to extract it:
Code:
#!/bin/bash
#
[code]....
View 8 Replies
View Related
Mar 16, 2010
I have a BASH script which at one point asks the user a yes/no question. I want to make it so that if the user types in an invalid input 3 times consecutively then the BASH script will echo an error and terminate with exit status 1.
View 9 Replies
View Related
Apr 16, 2011
I'm having a bit of an issue using overloaded operators in an already overloaded operator. In my following code, I have overloaded the && operator to compare two Course objects. The operator in turn goes to a function which calls other overloaded operators to compare private object variables of that object to compare them.
View 8 Replies
View Related
Sep 15, 2010
I am querying a single string column in a table. The string values have spaces in them. I want to loop over each value in bash. I set IFS to split lists on newlines instead of spaces. When I try this, it is splitting the list of results on the actual character 'n', not the newline ''.
DATA=`mysql -u root -ppassword --silent 'SELECT name FROM table_a;'`
IFS=$'
'
for i in $DATA; do
echo "item = $i"
[Code]....
View 5 Replies
View Related
Jan 22, 2010
This one is driving me crazy.
My .bashrc is set as:
if [ -d ~/.bashrc.d ]; then
for file in $(/bin/ls ~/.bashrc.d/); do
[code]....
View 3 Replies
View Related
Oct 22, 2010
I have a server with what appears to have 352 home directories (350 actually if you omit '.' & '..') & I am being asked to basically tally a list of whom all 350 users are in alphabetical order. Now I could sit here for days doing the 'finger' command to obtain their full name commented in '/etc/passwd' file but I would assume there is a script or way I could have Linux quirry the '/etc/passwd' file & take all the user 'comment' entries and export them to a list in alphabetical order. Does anyone know if this could happen and if so, how would I do something like this? I can't write bash / shell scripts to save my life
Code:
cmennens@mail]:/$ ls -l
total 160
drwxr-xr-x 352 root root 12288 Oct 21 13:41 home
View 7 Replies
View Related
Jan 29, 2010
i am not able to understand the appropriate thing to put in the google search...
Is there a way to use the ?: operator for if-else decision in a shell script?
edit: the 'question mark - colon' operator (just editing so that its searchable by someone in need :-P)
View 3 Replies
View Related
Oct 14, 2010
$dec93 = 93;
$ser = SERVO;
$lbit = uc(sprintf("%02x
", $dec93));
if($lbit == 5D){
print DATA "Byte11: $fbits11=$bstr11 Bits:[95-88] $ser
";
}else{
sleep(1);
}
Why do I get this error? Bareword found where operator expected at C:Perl ScriptsLbits.pl line 64, near "5D" (Missing operator before D?)
View 2 Replies
View Related
Jan 7, 2010
list the 'chkconfig --list' in alphabetical order
View 3 Replies
View Related
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
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
Jun 1, 2010
#!/usr/bin/perl -w
use strict;
my @files = `ls -1`;
[code]...
View 2 Replies
View Related
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
Feb 5, 2011
I cannot seem to get if else statements to work. if $choice == Dog then i want it to say "you selected Dog" The variable choice has the value Dog in it as proved at the end by echo "yes $choice is $choice" following the error Code: ./test.sh: 37: [$choice: not found How do i get the conditional statement to work? What's wrong here? This is the full script:
Code:
#! /bin/sh
: ${DIALOG=dialog}
: ${DIALOG_OK=0}
[code]....
View 7 Replies
View Related
Feb 8, 2010
I need to copy my music to a portable HDD in alphabetical order. My headunit in my car will only display the folders and files in the order that they were written to the disk so to have any form of logic to the album / track listings they need to be written to the disk in alphabetical order.
how to do this in openSUSE? I know dolphin doesn't do this.
View 9 Replies
View Related
Mar 10, 2009
Using PHP 5.x. I would like to sort a set of values first numerically, then alphabetically. For example, here's my code so far:
Code:
<?php
print "<p style="font-family:verdana;font-size:10pt">
";
$myArray = array("1223:starfruit", "34112:oranges", "1223:zucchini", "321:apples", "34112:pears", "1223:tomatoes");
[code]....
I have fiddled with array_multisort but I can't seem to get my head around it or the many sort routines in PHP.
View 3 Replies
View Related
May 26, 2011
I am running fully updated ubuntu 10.10 and now, since 2 days ago, when I open a file
in open office, gimp or gedit etc the directories and files now appear in reverse alphabetical order.
View 8 Replies
View Related
Jan 22, 2009
In Linux, the files were processing based on timestamp. How to process the files based on alphabets? My application is in windows. Here I am processed the files based on alphabetical order. While coming to linux its coming wrong.
View 5 Replies
View Related
Oct 2, 2010
My goal is to download a .deb package(e.g vlc) from the cmd line so that I do not always need to connect to the internet using the normal apt-get install cmdFrom the cmd line I typed sudo apt-get -d install vlc. After the operation is completed, is the downloaded file in a .deb form and where is it downloaded to?
View 3 Replies
View Related
Jan 9, 2011
I have an application in my company PC running on Fedora Linux.Can dyndns be used to access from outside world?
View 5 Replies
View Related
Mar 24, 2010
This problem has been here for 2 months or so:
If I, in VLC, choose a folder with several mp4 or other multimedia format files, it will show em in the playlist in random order, definitively not alphabetical. that didnt use to happen before.
View 5 Replies
View Related
Feb 15, 2010
I'm trying to get Chinese filenames to be listed in alphabetical order according to pinyin. Long ago I remember having to install a particular package for that to happen, but in the past year or so I believe that ubuntu at least was doing that automatically. On my most recent linux installation, however, I find that it's not sorting file names by pinyin order. I'm wondering if I have forgotten to install something this time.
View 1 Replies
View Related
Nov 8, 2010
if [ $games -gt 0 ] ; then
echo ""
echo "*** New Game! ***"
[code]....
View 6 Replies
View Related
Sep 2, 2010
I'm using Net::Bluetooth to create an RFCOMM socket on my Linux box. I need for it to register with SDP with a specific UUID. The perl code can be viewed in this link. I am unable to make the connection from a remote device however. This remote device (my Android phone) is able to connect to other RFCOMM devices using this UUID. I would like to troubleshoot the problem, but I can't find a way to browse the LOCAL SDP records of my PC where the Perl script is running (and waiting for incoming BT connections). how to browse the SDP records on the local PC?
View 1 Replies
View Related
Aug 4, 2010
I configured ldap server & client on centos,then i connected centos and suse with network.now want to get group of any user from this server via suse.is it possible with perl scripts? or i need to install other modules on suse or centos?(such as : pam,nss)
View 8 Replies
View Related
Feb 12, 2011
i write this script:
[Code].....
i make this script to become a service ( i test it from bash, and my script work good), my problem is when i telnet to my local host (127.0.0.1) via a personal port like 5555 telnet give this error: ")syntax error: invalid arithmetic operator (error token is ", i know this error is for echo $(($A+$B)) and i know that telnet can not calculate $A+$B and the error is for this
View 3 Replies
View Related
Jan 28, 2010
i want to know how to view tamil websites in redhat linux EL5.pls assist to know the detail.
View 5 Replies
View Related