Ubuntu :: How To Make Variable And Read From Second Terminal
Apr 27, 2011
I have two terminals open and I want to save the current path in a variable and read it from the second terminal that I have open.
Then in the first terminal I type:
Code:
A=$(pwd)
And in the second I type:
Code:
echo $A
that doesn't work though.
I have tried also with
Code:
export A=$(pwd)
and
Code:
alias A=$(pwd)
but nothing seems to work. Is there a way to do this?
View 4 Replies
ADVERTISEMENT
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
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
Jan 24, 2011
gnome-terminal from the Debian squeeze does not use the 'default_size_columns' and 'default_size_rows' from the /apps/gnome-terminal/profiles/Default/ folder of gconf.
View 6 Replies
View Related
Nov 12, 2010
Recently I've updated from 13 to 14. However, after updated I've tried to work with my terminal and it seems doesn't works fine. I can read 'starting terminal' but after that it's closed.I've uninstalled and re-installed it through the graphical tools (gnome-terminal) but that doesn't works fine.
View 3 Replies
View Related
Nov 8, 2010
I googled and tried to find an easy step by step-by-step guide on how to use a bash script read a variable from a file. This is the way I did it (but it does not really work so something is wrong, but what?) (testfil2 contains one line that readsidnumber=1578
#!/bin/bash
value="/home/user1/Desktop/testfil2"
echo $value
kill $pidnumber
View 4 Replies
View Related
Jul 14, 2010
I am trying to write a script which can read the names of all folders within a given folder into separate variables. In effect, if a folder contains a folder "Folder1", "Folder2", "Folder3", the script would read those names into variables such as:
Variable1 = "Folder1"
Variable2 = "Folder2"
Variable3 = "Folder3"
I have tried fiddling with the find . command, but without any success.
View 3 Replies
View Related
Jun 8, 2010
What's the best way to read a value from a configuration file into a script?I'm trying to get the command_file vaule from nagios.cfg into a script, this works but what's the best way to do it?
Code:
command_file=$(perl -F= -lane 'print $F[1] if /^[[:space:]]*command_file[[:space:]]*=/' /etc/nagios/nagios.cfg)
View 5 Replies
View Related
Nov 11, 2010
I have a problem when i ried run this command (export HISTTIMEFORMAT="%F %T ") on slackware 13.0. the answer is the following (-bash: HISTTIMEFORMAT: readonly variable) I am running this command on the bash like root.
View 2 Replies
View Related
Sep 24, 2010
I created the following.
x="top
middle
bottom"
I would like to make the following work.
while read line
do
echo $line
done
instead of importing a file I would like to use the variable $x I tried using pipes, but with no luck. My goal is to read one line at a time, but not have to export my data to another file, I would like to keep it all within one script.
View 3 Replies
View Related
Feb 27, 2011
At my wit's end I can't find anything that I understand well enough to use. This is for a Unix class, we are working with shell scripting. File1 has 5 in it and File2 has 100 in it.The teacher wants us to read the values then do the math. This is what I have so far:#!/bin/bashvar1='cat File1'var2='cat File2'var3=`echo "scale=4; $var1 / $var2" | bc`echo The final result is: $var3
View 9 Replies
View Related
May 25, 2010
he clicks on everything on his GNOME desktop, and manages to delete everything, including menus, icons, etc. The people he lives with aren't skilled enough to fix it, and I live a good eight hours away. I have remote capabilities with NX, but that requires them to initiate a connection to my workstation here, which is more painful than I thought it would be. I need a way of locking down the desktop, so it's read-only, so he can't make the changes he seems to keep making. I figure I could make the .gnome directory read-only, but I don't know if that would affect the normal operation.
View 3 Replies
View Related
Mar 16, 2010
I want to add a path (/usr/sys) to the global $PATH. I will use this to test commands and scripts, which I don't want to be mixed up with regular commands. I've added the path to /etc/environment. When I start a terminal session under my user account, the path is included in the $PATH variable. However, when I start a root terminal, it is not. Is there a way to to change $PATH on one place where it will also affect the root terminal, or do I have to change it on 2 locations?
View 4 Replies
View Related
May 2, 2010
I am looking for a clue in shell or ant script, where I excecute a binay file on linux. For example ./myfile.bin which ask me few questions.
./myfile.bin ...........................100%
I would like to automate this process where I want to pass the hostname as a variable or read from a file is it possible? If yes any sample`s on this. I can do if this was a shell script ($1) but not sure when its binary.
View 8 Replies
View Related
May 10, 2010
Is it possible to make terminal (xfce4-terminal) transparent from bash script?
Maybe by enabling compostion?
View 1 Replies
View Related
May 14, 2011
I am trying to save the PATH environment variable from the Terminal running on a Ubuntu system.I typed in the following however it does not get saved.
export PATH=/home/david/Komodo-Edit-6/bin/:$PATH
View 1 Replies
View Related
May 6, 2010
I've been wanting to do this, basically all I need is the image for the terminal and a know how on how to change the text to a lime green.
View 5 Replies
View Related
Aug 13, 2009
The Linux mint terminal has green and blue for the prompt. How do I make the Ubuntu terminal look like the Linux mint Terminal? I have looked at the color settings under the Terminal profile preferences and I do not see that setting available there.
View 6 Replies
View Related
Aug 3, 2011
I am using CentOS5.5 & everytime it is showing command not found. If I export the path as below it will be working fine until a reboot. Again same error i.e command not found if I open new terminal. Every time I am exporting as below:
#export PATH=/sbin/:$PATH
#export PATH=/usr/sbin/:$PATH
#export PATH=/usr/bin/:$PATH
#export PATH=/bin/:$PATH
How can I set these permanently as that the paths should automatically be exported for everyone user whenever the system boots. And command completion also should happen for eg. #fdi (press tab), then it should show available options such as fdisk, etc.
View 7 Replies
View Related
Jul 13, 2011
I am bad with bash programming and I need some help how I can make variable names out of a string.I will need some help start doing that. And I think the first would be to get part of the filenames strings into variables.
View 7 Replies
View Related
Apr 1, 2011
I'm trying to make an environmental variable RPMS that will resolve to a website. I know I have to make the changes in .bash_profile, but all the things I try don't seem to want to work.
I've tried:
PATH=$RPMS:ftp://rha-server/pub/os/rhel5/Server/
or simply just making the variable itself
$RPMS=ftp://rha-server/pub/os/rhel5/Server/
The second one made a variable just fine, but when I attempted to run this command:
rpm -ihv $RPMS/caching-nameserver*
View 5 Replies
View Related
Apr 23, 2011
I am trying to strip the .wav file extension from a file name so that I can pass the result to lame encoder. I started to write a BASH script that looks like this:
Code:
for f in /home/user/wavfiles*; do FILE=basename $f .wav; lame $FILE; done
It doesn't work very well though. For the life of me I can't seem to discover how to use basename in a suitable way for a script like this.
View 8 Replies
View Related
Apr 18, 2009
I have a program I am writing where I have a for loop and I want to make it substitute the variable twice like:
for ((i=0;i<5;i++)) do
echo $"$i"
done
[code]...
View 3 Replies
View Related
Dec 16, 2008
How can i make a variable in a bash script, to refer each file in a folder,and to switch it to the next file,until the last file of the folder?
View 2 Replies
View Related
Feb 8, 2011
i am runing the below script
foo..
if [ "$type" == "ok" ]
then string=ZZZZ:I=$number
elif [ "$type" == "NOK" ]
[code]....
the code inside sc2.sh needs to read the input from the variable (string) above. is there any way to make this variable recognized inside the sc2.sh
View 3 Replies
View Related
Dec 14, 2010
How can I make radiolist dialog which content so many options what is the value of the variable?Quote:
echo "How many options?"
read=VAR
dialog --title "sdf" --backtitle "sdff" --radiolist "ffdsfsd" 15 60 5 "1" "first" on "2" "second" off "3" "third" off "4" "fourth" off etc..
I must explode dialog in loop and add options? or something like that?
View 2 Replies
View Related
Mar 31, 2010
Basically i have a 1TB USB HDD that is formatted HFS+ (i used to use it attached to a hacked AppleTV, it has loads of media on it).
Appletv wasn't great, so now i have a lovely acer revo running XBMC Live, and it's blooming great. my problem is my USB drive mounts, but i think it's read-only, as i am struggling to sftp new files to it. so my question is:
How do i make the drive writeable?
I've read things about disabling journling, an fstab file, chown in terminal, but im really struggling.
In temrinal if i navigate to the /media folder and run ls -al, i get this: (note the usb drive is called AppleTV)
revo@XBMCLive:
How to make it read-write? i'm happy for it to have full write access by root, or all users or whatever. im sure its 1 line in terminal!
View 1 Replies
View Related
Feb 19, 2010
When I try to go to a virtual terminal from X the writing is too dim to read. When I boot to run level 3 all is fine, then I "startx" and use the gui. If I "ctrl-alt-F3" the printing on the screen is so dim that I can't see it. Is there a setting for this somewhere that I haven't found. Before installing Slackware 13-64 I ran Zenwalk for over a year and never had this problem.
View 2 Replies
View Related
Jan 12, 2010
i know that chmod +x makes a certain file executable but how do i make a file read and write.
View 3 Replies
View Related
Dec 26, 2010
I have a simple WD external USB hard drive, but when I plug it into my computer nothing happens. Not only is there nothing popping up, but I cannot access it through the file browser. The light on the hard drive turns on as usual.
View 3 Replies
View Related