Ubuntu :: Check For Variable Length In Script?

Feb 2, 2010

I want a line or lines to check for variable length in my script. I just want to check if a variable the user inputted is 4 characters long, and if it isn't to return a false or exit status of 0.

View 6 Replies


ADVERTISEMENT

General :: Variable Length Console Prompt?

Jul 15, 2010

I have a question about the prompt. it is very easy to tune it for it to be colored and display path where you are etc. But my problem is that when the path is too long I would prefer the code line to be on the folowing line...

Ex
11:00 me@host a/short/path > ls -ltr ./stuff
11:00 me@host a/very/very/very/long/path
> ls -ltr ./stuff

and to be honnest as I am very new in LINUX I don't know how to do this...

View 7 Replies View Related

Programming :: Parse Files With Variable Record Length?

Aug 6, 2010

I would like to extract Room number, Lastname,Firstname,invoice (205880080),arrival date, departure date, and total(229.46). Can you at least give me a hint on how to proceed? I have tried a lot but I am stumped from the beginning.

***History***
Room: 124 B Payment: Bell/TRAVELSCAPE.COM
Lastname*FIT*,Firstname 4A, 0K, 0B Guest
Bell *205880080 FT
Bell *205880080 July 31, 2010

[Code]...

View 4 Replies View Related

General :: Implementing A Variable-length List Of Keywords In Mysql?

Sep 20, 2010

I'm having a hard time googling for answers because I keep using the word "keyword."

I've never really used any kind of database before, but I want to learn the basics, so I'm playing with it a little bit at work. What I want to do is make a database to hold information on various articles. For example, with columns for the title, author, and date. Those are all easy. The tricky part is that I'd also like to be able to label articles with keywords so I can search for certain topics.

Since there's no way to know ahead of time how many keywords, if any, each article might warrant, I'm not sure how to put this in database form. There's no variable-sized array data type. It seems sloppy to just list them all in a single VARCHAR column. Making several columns that may or may not be left null and putting one keyword in each seems wasteful.

View 2 Replies View Related

Programming :: Directory Record Length Is Variable In Ext2 Filesystem?

Jan 7, 2011

The declaration for directory record length in ext2 filesystem is as follows:

Code:
#define EXT2_NAME_LEN 255
struct ext2_dir_entry_2 {
__u32 inode; /* Inode number */
__u16 rec_len; /* Directory entry length */
__u8 name_len; /* Name length */
__u8 file_type;
char name[EXT2_NAME_LEN]; /* File name */
};

Some say because the record is not in a fixed length so rec_len is the real record length. Why is the length of the array `name' not fixed? I thought C arrays like this should be fixed length. C99 has variable-length arrays, does this structure count on C99?

View 7 Replies View Related

General :: Sed/awk/grep Search For Number String Of Variable Length In Text File?

Jan 19, 2010

I need to search a text file for a string of numbers which are different lengths, and always are between number=" and " like:

number="1234567890"
number="22390"

I need to grab those numbers and pipe each one to a line in a file. I've already tried something with awk and that didn't seem to work.

View 10 Replies View Related

Hardware :: How To Check System Bit Length On Machine

Aug 23, 2010

how to check my system bit length on linux machine.?

View 1 Replies View Related

Programming :: Eliminate "ISO C++ Forbids Variable Length Array" Warning?

Jan 27, 2011

As subjected I have this warning message code...

How can I get rid of this warning message?

View 6 Replies View Related

Programming :: Check If The Variable Is A Number Or Not

Apr 30, 2011

I've created (as a homework) to create as many folders as told but I still need to check if the variable is a number or not :

Code: #!/bin/sh
echo "Veuillez saisir un nombre"; read nmbr
nmbrf=$nmbr
while [ $nmbrf -gt 0 ]
do mkdir -p "foo$nmbrf"
nmbrf=`expr $nmbrf - 1`
echo "$nmbrf"

how do I check that nmbr is a number or something else?

View 1 Replies View Related

Programming :: Check If A Variable Holding A Character Is A Hyphen?

Mar 4, 2010

I am having trouble with the code below, I'm trying to check if a variable holding a character is a hyphen.

Code:

#!/bin/bash
$char="-"
if (( "$char" == "-" )); then

[code]....

View 3 Replies View Related

Programming :: Access A File Line By Line, And Check The Length Of Each Line.

Feb 13, 2011

I want to access a file, and check the length of every line.After, i want to check and replace all lines with length over 10 characters, with a message.Does anyone have a clue on that?

View 1 Replies View Related

Programming :: Check That The Same File Exists Within Two Different Directories Using A Filename As A Variable?

Apr 30, 2010

I am in need of a way to check that the same file exists within two different directories using a filename as a variable. Here is the process which requires it: The script is reaches out (via ftp) and pulls down a file(s) and delete it afterwards. This is halfhazard because in the instance it doesnt pull down the file, yet still deletes it, we are up a creek. I am looking to pull it down to a temp location and then verify that file exists in the location in which it needs to be present to process before deleting it, adding a little extra layer for security. The script itself is finished.If I put a file name in manually it works perfect. I just need a way to pump the filename into the variable.

View 1 Replies View Related

Programming :: Bash - Read Content Of File To Variable And Use This Variable In For Loop ?

Aug 21, 2009

I'm trying to read content of file to variable and use this variable in for loop. The problem is, when I have c++ comment style in file - /*. Spaces in line are also interpreted as separated lines.

For example:

Code:

Changing $files to "$files" eliminate these problems but causes that whole content of variable is treated as one string (one execution of loop).

View 6 Replies View Related

General :: Assign Local Variable Values To Global Variable?

Feb 17, 2011

how to assign a local variable value to a global variable....

View 2 Replies View Related

Programming :: Make A New Variable With The String From The Old Variable Btut Without Any Plus Sign?

Apr 7, 2010

my script has a variable which comes in the form +00.00 +0.00 -00.00 or -0.00 (the numbers can be any in that form) for any that have a + symbol I need to remove the +, but if it has a - symbol it needs to stay.

i need to make a new variable with the string from the old variable btut without any plus sign. I have tried a lot of different ways with no success, each thing I tried either left the + or removed the entire string. I think this should work but doesn't

foo=+12.40
bar=${foo#+}

View 4 Replies View Related

General :: Create An Environment Variable With The PRINTER Variable?

Apr 16, 2011

I am supposed to create an environment variable with the PRINTER variable, which should resolve to the word sales. Would the command be like this?: env PRINTER - NAME=SALES (is this the command to create that variable with resolving the word sales to it?)

View 3 Replies View Related

Software :: Get Variable From Text File Into Bash Variable?

Jun 10, 2009

I have a text file i that has a mailTo: NAME in it. In a bash script i need to extract NAME and put it in a $variable to use. How do i do this?

View 2 Replies View Related

Programming :: Search Within A Variable And Assign The Results To A New Variable?

Apr 25, 2011

how I can search within a variable and assign the results to a new variable. I'll use the following as an example -

cars="Audi BMW Cadillac Chevy Dodge Ferrari Ford Mercedes"
list=`echo ${cars} | egrep -o '<A?+|<C+'`

with the echo command I get the following output assigned to list -

A
C
C

What I'd like to get for output is -

Audi
Cadillac
Chevy

how I could do this regardless of upper/lower case letters?

View 5 Replies View Related

Programming :: Assign Value Of C Variable To Shell Variable?

Apr 28, 2010

included shell script inside c program, and i wanted to assign the value of c variable to shell variable..Can any one please suggest me how to do it?

View 8 Replies View Related

General :: Use The Value Of One Variable To Generate A Name For Another Variable?

Jul 25, 2010

can i use the value of one variable to generate a name for another variable? for example i want to use the counter from a "do while" loop to name and define a variable each time the loop executes. for example

objectnames1=`ls -a`
objectnames2=`ls -a`
etc.

i don't have a script yet but each time through the loop i intend to cd to a particular directory and then define a variable containing a list of each object in that directory as values. for the rest of the script to work, each variable generated has to be unique, and i can't think of a good way to accomplish this.

if using a value from one variable to name another isn't possible, can anyone think of a more elegant solution? i know limited syntax but i'm willing to read up...

View 6 Replies View Related

General :: Sed Substitution Of Variable With A Variable?

Dec 27, 2010

I am trying to alter the character position of residue numbers above 999 in a pdb file.The following script is an attempt to:1) Get all unique pdb residue numbers (in column 5) using awk and assign it to a variable i.2) Loop through all the values in $i and if it is greater than 999, shift that number one character to the right using sed.However, the script only manages to alter the final residue numberCould anyone please advise how I can loop through all values in $i and shift it one character to the right?

#!/bin/bash
# Script to alter position of residue number in pdb file for resid above 999
i=$(awk '{print $5}' wt-test.pdb | uniq)

[code]...

View 6 Replies View Related

Programming :: Assignment To A Variable Variable?

Mar 17, 2011

This loop is part of a bash script which takes multiple arguments.

Code:
for ((i=1;i<=$number;++i)) ; do
offset=$(($i+5))

[code]...

View 3 Replies View Related

Ubuntu Security :: Password Characters And Length

Mar 24, 2010

I need a little insight, and I�m not sure if the two can relate, but I am trying to find out the following.
When generating WEP Keys the available bits are: 64/128/152/256; however, you need 5/13/16/29 character respectfully for each key if you generate the key manually.Can this formula be applied to passwords and the length of the password? For example: if my password had 29 characters, could I say that my password is 256-bits?

View 9 Replies View Related

Ubuntu :: Gnome Panel Length Restriction?

May 6, 2010

Is it possible to prevent the panel from expanding to where the -ox buttons appear on a full sized window. I use the panel hide pref with the panel not fully extended to the width of the scree. If the panel gets too big then it drops down each time I click to close the window. I would like to limit the overall length of a panel. Is it possible?

View 3 Replies View Related

Ubuntu :: Use Full Length Of Screen For Conky?

Oct 8, 2010

I am trying to get conky to use the whole length of the screen instead of just have.This is my conky file. PLease help.

Code:

Conky 2
background yes
use_xft yes
xftfont HandelGotD:size=8

[code]...

View 1 Replies View Related

Ubuntu :: Change The Length - Elevated Privileges Are Up?

Mar 28, 2011

I get really annoyed when I am in command line or doing a big purge of software and I have to enter my root password every minute or so.

How to change the length my elevated privileges are up?

View 9 Replies View Related

Ubuntu :: Crazy Length Text Boxes In Web Browsers?

Jun 16, 2010

did a search and I can't believe I seem to be only person reporting this. It's been a bug since I did a fresh install of 10.04 UNR, but it's only gotten to the tipping point where I actually HAVE to do something about it today. I finally cracked.As you can see in the screen shot attached the one line text box (ie, search bars mostly, but the thread title in this case) stretches way beyond length it is supposed to. For the first screen shot I have "zoomed out" to give a better idea of the full effect, the second screen is what I see during normal browsing.If anyone could help me fix this error it would be greatly appreciated. I've tried both Firefox and Chrome (and Chromium) and the same issue occours. The screen shot is taken from Chrome 5.0.375.70

View 9 Replies View Related

Red Hat / Fedora :: Nul Files Appearing With Zero Length

Apr 14, 2010

I am working on a system that uses Red Hat Client 5.3. Files keep being created all over the system. They are all named nul and are zero length. We use a common login and thy are owned by this login account. I have grep'd the entire system looking for some code that would be writing these files but nothing has come up.

View 2 Replies View Related

Software :: Get Received UDP Packet Length?

Feb 12, 2010

How to get the length of received UDP packet? Using wireshark I could see the correct length of datagram. How can I print this value in my simple udp server program? I am receiving binary data (Non printable ascii characters as a data) So I can not use strlen(buf) which throws incorrect length.

Code:
if (ret=recvfrom(s, buf, BUFLEN, 0, (struct sockaddr *)&si_other, &slen)!=-1){
error = ioctl(s, FIONREAD, &value);
printf(" from ioctl UDP packet length is : %d error is : %d
", value, error);
code....

View 1 Replies View Related

Programming :: How To Find Array Length In C

Jul 3, 2011

I would like to know how can I find array length in C .I have array of structure and I want to sent it to different functions and I want to have it's length (number of elements) each time I want to use it and I don't like to use any additional variable to pass the function for each of arrays that I pass to function.
How can I do that?

View 5 Replies View Related







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