General :: Write A Workable Script That Demonstrates That Variable Expansion Occurs Before Pathname Expansion?
Jul 23, 2011how do I write a workable script that demonstrates that variable expansion occurs before pathname expansion
View 14 Replieshow do I write a workable script that demonstrates that variable expansion occurs before pathname expansion
View 14 RepliesIn my .bashrc file, I am attempting to set JAVA_PATH to a local path, using the HOME environment variable or '~' symbol as shown in the following examples.Using ${HOME}
export JAVA_PATH='${HOME}/Software/java/jdk1.6.0_24'
When I attempt to use ${JAVA_HOME} in a my ${PATH} javec is not found. To debug it, I tried a simple ls command:
ls ${JAVA_HOME}
and get the following error:
ls: ${HOME}/Software/java/jdk1.6.0_24/: No such file or directory
Using '~': Trying to use '~' symbol as follows:
export JAVA_PATH='~/Software/java/jdk1.6.0_24'
the ls command results in the same error, however javac is found.I prefer the '~' symbol anyway, but would like to understand why the ls command does not work for either, and why it seems as though ${HOME} is not being expanded.
I'm trying to use brace expansion on a string, but I can't seem to get it working with variable substitution:
Code:
$ cat script.sh
#!/bin/bash
echo {1,2,3} # 1.
VAR=1,2,3
[code]....
I've searched google, tldp.org and these forums and I can't seem to find an example of how this would work. I want #2 to work like #1. Any suggestions?
**Edit: I forgot to add, the values in VAR are not sequential and can have multiple digits. For example, VAR=13,17,10.
**Edit2: [URL] The bottom line of code in the first gray block of code shows that you cannot use variables in such an expansion:
Code:
#!/bin/bash
a=1
b=5
echo {$a..$b}
But I'm looking for pasting the complete contents of a variable into these braces, not some portion of it...
What I am trying to accomplish is a way to read only the lines that have been added to the file mylog0 since the last time the script looped (5 seconds). I am open to new suggestions too, I have been stuck on this little script for a few hours already.
Code: #!/bin/bash
i=0
firstline=0
[code]...
This script is intended to allow you to simultaneously run a command on a set of remote hosts in a single gnome-terminal tabbed window. It runs it through screen so if it's a long process it's immune to network failures.
The command string gets built ok, but when it comes to executing the gnome-terminal command, it chokes with
Quote:
Argument to "--command/-e" is not a valid command: Text ended before matching quote was found for ". (The text was '"ssh')
If you copy/paste the "Running: gnome-terminal" line, it works as expected.
I'm pretty sure the problem is with the commandline variable expansion, but dont know what else to try.
Another thing I'd like to be able to do is keep the shell open after the command finishes. Right now, I just get "screen terminated" and the gnome-terminal tab says bye-bye.
Code:
Code:
I plugged in a seagate expansion drive 1Tb into my linux server for backup purposes but it is unable to mount it. I can see the expansion drive in My computer but when I click on it, it says unable to mount, device already mounted or busy. Windows can read the hard disk with no problems. It is ntfs formatted. I installed ntfs kernel and fuse. Ntfs is displayed when I run cat /proc/filesystems. However it just can't mount the expansion drive.
View 7 Replies View Relatedit says cant mount volume and wont recognize my seagate expansion drive after I had the seagate plugged in to a windows pc! It says something about using command line to fix it but I'm new to Linux and don't know what to do!
View 1 Replies View RelatedIs there an easy way to prevent the logging of commands run into syslog as post-shell expansion?
I.e log a command of "ls *.log" as just that, rather than "ls a.log b.log c.log d.log" It makes rather a mess of the log files.
I am reaching the upper limit of my /home partition. As shown in the image attached, my /home is located in /sba3, and I have an additional partition for storage in /sba6. Since Lucid Lynx is about to be released, is it possible using the GPart software on the LiveCD to remove the /sba6 partition, add 1 GiB to my swap partition and the rest to /home without messing up all of my data in /home? So far in my search of the forum I have not come across anything exactly touching this subject, so I am requesting some guidance before proceeding. I have already back up all of my data for a full clean install if it comes to that.
View 2 Replies View RelatedI am interested in a more flexible targeted search in my directories. For example, if I am searching for all .txt .dat and .bat files (then perform an operation), I would think that the following would work:
find . -name '*.{txt,dat,bat}' -exec ...
But I get no results. I am running on Cygwin.I have confirmed that:
find . -name '*.txt' -exec ...
find . -name '*.dat' -exec ...
find . -name '*.bat' -exec ...
all find the aforementioned files. But, find . -name '*.{txt}'still produces no output.
I am testing a PCI card in a 4-slot bus expansion chassis. I bought the chassis from CoolDrives.com, it appears to be identical to the Startech PEX2PCI4 unit, but was quite a bit cheaper... This device shows up on my lspci output:
05:00.0 PCI bridge: Texas Instruments XIO2000(A)/XIO2200(A) PCI Express-to-PCI Bridge (rev 03)
I think that the following line may also be associated with this device:
06:07.0 PCI bridge: Hint Corp HB6 Universal PCI-PCI bridge (non-transparent mode) (rev 11)
I've installed in the expansion chassis one card, a Linux Media Labs BT484 card. This card works out-of-the-box when installed directly in the system, using the bttv driver. Installed in the expansion chassis, the card still shows up as follows:
07:00.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
07:00.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
07:01.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
[code]....
When the card is installed directly in the motherboard it gets IRQ17 or 18. I suspect that it does not really want IRQ0, but that there is some problem detecting the proper IRQ over the bus expander. One possible approach I am considering is to build a custom version of the driver where I can set the IRQ manually to something else just to get the driver to finish loading, then see what happens when I run the card. This would at least tell me which IRQ the hardware is really using and whether or not the 0 reported is correct or not.
I've added a new LUN to my Centos 5.2 server using Powerpath and have added it to an ext3 logical volume. I extended the logical volume using lvextend and the new space shows up correctly in lvdisplay. What I'm having problems with is getting Centos to see the new disk space (df -h shows 500GB, not 600GB as expected). I've tried running a resize2fs on the new volume but it tells me that "the filesystem is already n blocks long. Nothing to do". Does any one know where I'm going wrong? If possible I'd like to sort this without a reboot.
View 3 Replies View RelatedI have an Acer Aspire One and I would like to boot from an SCHD card installed into the system Expansion port. It works fine when used in a USB stick. When I check the boot order the expansion port is not listed as an option. There is an option for doing a network expansion. Are there any bios updates that would read that port on startup?
View 1 Replies View RelatedI slipped on my expansion drive cable and it disconnected quickly, when I reconnected I got this error: Error mounting: mount exited with exit code 13: $MFTMirr does not match $MFT (record 0). Failed to mount '/dev/sdb1': Input/output error NTFS is either inconsistent, or there is a hardware fault, or it's a SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows then reboot into Windows twice. The usage of the /f parameter is very important! If the device is a SoftRAID/FakeRAID then first activate it and mount a different device under the /dev/mapper/ directory, (e.g. /dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation for more details.
View 1 Replies View Relatedi have to write a shell script that takes name of the file as command line argument and the script should use path envt variable to look for the specified file and specify where are the different instance of the filename specified exist
firstly enter the filename echo "enter the filename" read filename by using ls command we can get to know how many links are there for that file but i don't know how to get the pathname of the file and its links after knowing the pathnames of the file i can set the path variable using export command can any one tell me how to get the pathname of the file i entered as a command line argument
I edit /etc/environment file and write there my variable by it's not effected, what i need to restart daemon that it's show on echo $VARIABLE.
View 1 Replies View RelatedWe can use inotify related tools (fam, etc.) to know "when" a file change occurs, but, Can I know where (file position, offset) this change was made? For example, suppose that you have a big file and you are monitoring changes on it, using inotify-tools package or something like that you can take acknowledged if another process chage that file, but How can I know "where" that change was maded in order to avoid read all file content looking for a change maded?
View 5 Replies View RelatedCode:
# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
How would i write a script to display permission on each folders in $PATH variable below format.
drwxr-xr-x 2 0 root 4096 Nov 24 14:51 /usr/kerberos/sbin
drwxr-xr-x 2 0 root 4096 Nov 24 14:51 /usr/kerberos/bin
This is what i did but since it require awk programming i m stuck.
Code:
ls -ld <directoryinpath>
Code:
# echo $PATH | awk -F ":" '{ print $1 }'
/usr/kerberos/sbin
After completing the installation using kickstart , the exception is occured, just after performing post installation,i am sending the exception image
View 8 Replies View RelatedI have installed bluez.4.81....but when i install /home/george/Desktop/obexd-0.37.tar.gz,a configuration error occurs telling that libbluetooth is required. Is there any solution??
i want an option for receiving files.
how to assign a local variable value to a global variable....
View 2 Replies View RelatedI 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 Relatedfscheck is quite annoying, since it usually occurs when I reboot my system performing administration tasks. do I actually need fscheck if Im using the ext3 file system? if not how would I extend the period between checks or just turn it off altogether?
View 9 Replies View RelatedI get the following error when I try to boot vista thru grub. This is what I did, Got a new Hard drive installed it. Configured the bios to look at the new hard drive first. after installing vista on the new hard drive I switched the boot order and added the lines for vista(last 3 lines) in /boot/grub/grub.conf. I get the following the following error.I have to change the bios everytime i have to boot vista.
error 1: Filename must be either an absolute pathname or blocklist
#boot=/dev/sda
default=0
timeout=15
splashimage=(hd0,1)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.29.6-213.fc11.x86_64)
[Code]...
Im logged in as root in Fedora, What is the home directory pathname?
View 2 Replies View Relatedcan 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...
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]...
i install from
yum install rkhunter
rkhunter 1.3.6-4.fc12
Invalid XINETD_CONF_PATH configuration option - non-existent pathname
I'm just trying to figure out what is going on with FC12
Here is the error:
[root@localhost bigmac]# rkhunter --check
Invalid XINETD_CONF_PATH configuration option - non-existent pathname specified: /etc/xinetd.conf
I want to write a shell script which will simultaneously collect OS user information and write in an individual text files.Can anyone tell me the syntax of the script.N.B. The user name will be mentioned in an array within the shell script.
View 8 Replies View Related