General :: Use Result To Be Saved In Variable - Which Type Would It Be In Script

Feb 5, 2011

If I want to use that result to be saved in a variable, which type would it be in script? For clearing: let variable x and destination path is y/z

in prog.sh:
x=du -hb /y/z
echo $x

Q1: What type of x?

Q2: What option instead of -hb to presedent the size in kib?

View 11 Replies


ADVERTISEMENT

General :: Store Result Of Wc -l Command In Variable?

Apr 19, 2011

I want to store the result of wc -l as a variable so I can use it later in my script...so far unsuccessfully.

I have tried this:

set `echo awk '{ print $1, $6}' | wc -l` | echo $1

but it is far from working.

View 11 Replies View Related

General :: Assigning Query Result Into A Variable/file?

May 25, 2011

I am connecting to MySQL DataBase using shellscript and writing a select statement like select attachmentid from attachments where pageid=10175 I want to store the output of the select statement into a shellvariable or a file. How can i do it using shellscript.

View 4 Replies View Related

General :: Result Of Type Command Is Hashed And Shows Another Path In Brackets?

May 30, 2011

I came across this reult of the type command (hashed) in another post. (see below).

Code:

fraespappp8:/data/apps > type topic_file_publish.sh
topic_file_publish.sh is hashed (/data/apps/pnbgstk/publication/topic_file_publish.sh)
This (result = hashed) is new to me.

I wonder which kernel/distro/shell it is from.

View 1 Replies View Related

Programming :: Pass An Expect Command Result Into A Variable And Then Use It Again?

May 4, 2010

I'm trying to create a program that would locate the oldest file of a certain type on a server. Here's the commands:

OLDEST_PATH=`find -L / -depth -maxdepth 6 -mindepth 6 -type d | sort -f | head -1`
OLDEST_FILE=`find -L $OLDEST_PATH | grep .mp3 | sort -f | head -1`
ls -al $OLDEST_FILE

I'm writing this all in expect but I'm having problems. The main problem I have is whenever I try to run the first command, I can't seem to isolate the result of the OLDEST_PATH so that the 2nd command will work. There always seems to be a newline in the variable and the result is only "find -L" command running and it bypasses the variable. If I can just figure out how to get the 1st and 2nd command to work, then I can figure out the 3rd. Here's some code:

Code:
send "find -L / -depth -maxdepth 6 -mindepth 6 -type d | sort -f | head -1
"
sleep 20
expect -re "(.*)

[Code]....

I know there is a better way to write this. I've tried multiple ways and this just happens to be the last way I've tried it. If you try running this, you'll notice that there is still carriage returns after the result of OLDEST_PATH and it prevents the 2nd "find" command from working properly.

View 2 Replies View Related

Programming :: C++ Variable Type Followed By *?

Jul 1, 2010

In C++ what does the suffix, "*" mean appended to a variable type, e.g., "char* variable1;"?

View 3 Replies View Related

Programming :: Variable `GPIO_LED_ctl_ops' Has Initializer But Incomplete Type?

Sep 16, 2010

when i compile the device driver of led ,i get the erro like this:

[root@localhost led]# arm-linux-gcc -D__KERNEL__ -DMODULE -I /home/liumeng/lmldd
/linux-2.6.34.1/ -c -O -Wall led.c -o led.o
led.c:34: error: variable `GPIO_LED_ctl_ops' has initializer but incomplete type

[code]....

View 1 Replies View Related

Programming :: Book Example Of Own Type Variable Initialization Wont Work?

Nov 8, 2010

Its an example froom a book... and it does not work...

Code:
#include <stdio.h>
int main ( int argc, const char * argv[] ) {

[code]....

View 4 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

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

Ubuntu :: Can't Get The Variable "type" To Add The Line When Its Selected?

Jul 9, 2010

with my "if" statement? It's probably just a bracket or something stupid missing, but I cant get the variable "type" to add the line when its selected:

clear
read -p "Please Enter Printer Name : " name
read -p "Please Enter Printer IP : " IP
read -p "Please Enter Printer Description : " des
read -p "Please Enter Printer Location : " loc
read -p "Please Enter Printer Class : " clas

[Code]...

View 2 Replies View Related

General :: Getting Content-type/Mime Type Of The File Using Shellscript

May 24, 2011

I am copying the file form one directory to another directory using shellscript.

Here i want to get the Mimetype/Content-type of the file.

How to i can get the MimeType.

View 9 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

General :: Rpm -qa Doesn't Return A Result

Jul 3, 2010

I have an Ubuntu Linux on a VMWare running and I've installed RPM Package Manager. However when I try to query all packages using the rpm -qa command, I don't get any results returned.

View 2 Replies View Related

General :: How To Know If The Command Find Any Result

Oct 21, 2010

#!/bin/shLOOK_FOR="NTLMAuthenticationFilter"for i in `find ./ -name "*jar"`doecho "Looking in $i ..."grepjar -e $LOOK_FOR $idoneI wrote the script above, and try to find if there any file name LOOK_FOR exist in those jar,my quest is: grepjar -e $LOOK_FOR $ihere how can I check if there are any successful result , and output them ?

View 2 Replies View Related

General :: Use Command To Open First Search Result With Vi?

Nov 10, 2010

Every time I need to find a file and then open it, I have to use :
find ./ -name **.properties. , then copy the result, and then vi "paste the result here" .
If I need to use a mouse, it can be a little trouble. So is there any better way to do this?

View 6 Replies View Related

General :: Why Does Du -sl Show Different Sizes For Source And Result Of Cp -rl?

Jul 14, 2011

I have used cp -rl to copy a folder. When measuring the size of the source and of the result of the copy du -sl returns slightly different sizes, even though diff confirms that their content are identical.Both folders reside on the same hard drive, no modifications to any of them have been done between the copy and the measure. I found nothing in the documentation of du and cp which could explain the difference.

View 1 Replies View Related

General :: Where Are Special Key Mapping Saved

Aug 12, 2010

I've found several how-to's, but the "problem" is that all the ones I've found up to now involve using xmodmap. I'm not radically opposed to that, but, with debian, for some reason, I don't need it. I don't have a Xmodmap file, and yet, the special keys have their "names", instead of NoSymbol (on xev). Anyone knows where the settings are, whenever one does not use xmodmap?To make things weirder I've tried to create a Xmodmap to use with arch from debian, but it get the names all wrong, for some reason. (I used xmodmap -pke > .Xmodmap). I guess that whatever debian does, it has nothing to do with xmodmap then.

But I think it may not be possible. Besides not using xmodmap, on debian I have the correct keyboard layout set without having any command (well, at least not on my openbox startup script... it could be somewhere along all those "deeper" startup scripts, on /etc/rc.#/, I guess... I'm going to check there now), while on arch I have a "setxkbmap" on my openbox startup script.

View 3 Replies View Related

General :: New Email Addresses Not Saved?

Dec 5, 2009

I have my email on a separate partition so that my email doesn't get destroyed when I do new linux installs (I have emails from 5 years ago now). I also keep my sylpheed email addressbooks. This partition is writable by anybody and I have also made my user the owner of this partition during each linux install (media/email). When I set up sylpheed I tell it that my email is in /media/email and then it is able to write incoming messages to that location. The problem I am having is that I make symbolic links for my addressbooks from ~/.sylpheed* to /media/email using this:cd ~/.sylpheed*rm addrbook-000001.xmlln -s /media/email/addrbook-000001.xml addrbook-000001.xmlSylpheed finds my addressbook ok on my email partition but changes that symbolic link to a file on ~ when it writes new addresses. What am I doing wrong...I want it to write new addresses to my email partition?

View 4 Replies View Related

General :: Where Are Yum Downloaded Packages Saved

Jul 1, 2011

whenever i need to install a thing,i just do "yum install".... i need to know where all those RPMs are saved for future use...? i know something about

Code:

var/cache/yum

but i don't find all packages there...

Code:

yum.conf

View 10 Replies View Related

General :: CLI Commands To Generate Random Result From Specified List?

Jul 20, 2011

List of 77 lines with the names of movies. For ease, let's say it's in a text file. What I want is a command line argument I can pass that'll read each line and pick one of those 77 lines at random, except I can't figure out how to do this. Is there a program I can just pipe the output of 'cat listofmovies.txt' to?

View 13 Replies View Related

General :: Acpi Result In Hardstatus Line In Screen?

Apr 15, 2011

the command acpi gives me the percentage of battery that my laptop has.I would like to print the result of acpi in the hardstatus line of "screen".

View 5 Replies View Related

General :: BASH Script Will Not Get Use Result Of Command When Run As Cron Job?

Jul 1, 2011

I am frustrated by running a script on the Fedora 14 computer as a cron job. I paste the code:

Code:

#!/bin/bash
#a backup script to copy data from sda to sdc
ROOTVOL=`blkid -U ea210a08-6212-4dc8-be1c-23fce3b965bc`

[code]....

So when I run this as root, for example:

Code:

# /root/myscript

the result is what I expect:

Code:

Jul 1 13:41:16 svn root: ADMIN: Executing backup-svn
Jul 1 13:41:16 svn root: using blkid ea210a08-6212-4dc8-be1c-23fce3b965bc as /dev/mapper/vg_svn_backup-lv_root

[code]....

View 3 Replies View Related

General :: Check Character And Then Replace Depending On Result?

Oct 26, 2010

I have a CSV file with 8 columns. I want to check the 5th column, which will contain a single capitalised letter. If that letter is say "B" I would then like to replace the 2nd column in the csv with an incremental number starting at 0 (basically a count) with a prefix of B (B0000001) Sample row would be:

Code:

C, 0109390,sfs,sfsf,B,blah,blah

Amended row would be:

Code:

C, B000001,sfs,sfsf,B,blah,blah

View 14 Replies View Related

General :: Where Does All Updated Packages Get Saved In Computer

May 25, 2011

where does all the updated packages get saved in my computer in which I have installed Ubuntu 9.10? its really hard to download all those large files in slower Internet connection and the backups are unknown.please help me if i can save those downloaded packages in other devices.

View 4 Replies View Related

General :: Iptables Never Saved And Boot File

Feb 7, 2010

The last few times I had to restart my server, my iptables file was never saved and I had to load it from the backup. I always issue /etc/init.d/iptables save after any changes but for some reason it loads the default iptables file that came with the server.Any ideas on what to change?I would also like to use a default boot file that starts or restarts services like squid, nscd, postfix, iptables, etc - where can I edit that?

View 3 Replies View Related

General :: Execute Command Inside First Directory Of Each Matched Result?

Aug 8, 2011

I am working at a client who has a project where code is a mixture of different source control systems. So a layout might be like this

project/a/.svn
/a/subfolder/.svn
/b/.hg
/c/subproject/.svn
/d/.hg

So I am trying to put together a simple command that when executed from the project folder will run the appropriate hg/svn command in each project i.e:

[Code]...

Since the client has many such projects, Instead I am looking for a solution similar to find -exec where the svn/hg commands are automatically executed on each first level of match (i.e. svn up is run in the project/a folder but not in project/a/subfolder). How can such a command be constructed ?.

View 1 Replies View Related

General :: How To Grep - Internet Doesn't Give Any Result In System

Dec 17, 2010

I want to search files (basically .cc files) in /xx folder and subfolders. Those files (*.cc files) must contain #include "header.h" AND x() function. Clearly, I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings.

I tried several ways, and got only files with header.h OR x(). Some examples given in Internet doesn't give any result in my system. I am using Fedora 8.0 in my PC and I have grep 2.5.1 version.

View 5 Replies View Related

General :: Minimalist Server - LFS Too Complicated And Time Consuming For End Result

Oct 7, 2010

I am wanting to create the smallest server I can possible. I have a small server I use as a print server and for file sharing. The hard drive is about 80GB. Since I only run cups and samba, I see no reason to take up an addition few GBs with major distros just to run the OS. I know it is possible to get a small distro around 50MB or so. I would even be happy with an OS running around 200MB. what would be the best way to go about doing this? LFS is just too complicated and time consuming for the end result. Would something like Gentoo be better? Anything else that I may not know about?

View 11 Replies View Related







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