Programming :: Bash Script - Source Not Found
Feb 25, 2011
I want to edit the environment with a bash script, a part of my script is showed in the post. Its not everything, but the rest is working fine. At the begin of my script I've the follow line Code: #!/bin/bash
set -e First I tried with this solution. Code: sudo chmod 777 /etc
sudo rm /etc/environment
echo 'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"' > */etc/environment
sudo chmod 755 /etc
source /etc/environment Error, source not found
The second solution was this:
Code: sudo chmod 777 /etc
sudo rm /etc/environment
echo 'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"' > */etc/environment
sudo chmod 755 /etc
. /etc/environment
This one didn't give an error, but if I try this:
Code: ruby -v got an error
so the environment didn't worked.
If I use both commands
Code: source /etc/environment
Code: . /etc/environment
In the terminal, without a bash script, it works, so if I do
Code: ruby -v
It works and showed the right version.
View 6 Replies
ADVERTISEMENT
Apr 24, 2010
Is it possible to pass arguments to a source file in a bash script? For example
#!/bin/sh
#
. /dir1/dir1/funclib -a -b
How would you check for the passed arguments in funclib without getting confused with any arguments passed to the main script?
View 5 Replies
View Related
Nov 30, 2010
I have read where C is first converted to Assembly before its final compilation to binary. Is there a way to do this with Bash commands? I would like the understanding that Assembly allows to Bash somehow.
View 14 Replies
View Related
Dec 20, 2009
I have a Bash script that runs other bash scripts. If the parent code fails, is there any way for me to also kill the child code?That kills any multiple instances of a script if I run it more than once. Is there any way I can just modify this into something that prevents the child code from running/continuing from running if the parent stops from an error?
View 3 Replies
View Related
Apr 21, 2010
I have the following working script. It checks the directory for txt files, if files are there, it copies to another directory or gives error. I would like to exclude "file not found" errors and send them to /dev/null. All other errors should go to the email address as usual.
Code:
#!/bin/bash
function err
{
if [[ $? -ne 0 ]]
[Code]....
View 7 Replies
View Related
Sep 13, 2010
I wonder if there is anyway to make a user-defined bash shell function global, meaning the function can be use in any bash shell scripts, interactively or not. This is what I attempted:
Code:
$ tail -n 3 /etc/bashrc
echotm () {
echo "[`date`] $@"
}
[code]....
View 11 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
Feb 16, 2011
I am now working with full installation instead of liveCD and I am having a very strange problem with lpadmin command.
When I type man lpadmin I get the normal text explaining how to use it. However, when I run the command "lpadmin -p <printer name> -v lpd://<server>/<queue>" I get "bash: lpadmin: command not found". It doesnt even work when I use sudo -E before command.
View 3 Replies
View Related
Jun 5, 2011
I got a problem with terminal, since i'm really a noob with terminal i don't know how to fix it.Everytime i type in a command it shows for example:
-bash: ls: command not found
Even the basic commands don't work... just cd <directory> and those things works
View 9 Replies
View Related
Feb 4, 2011
I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.
View 3 Replies
View Related
Jan 24, 2010
simple bash code:
Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do
[Code]...
How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!
View 10 Replies
View Related
Jul 9, 2010
whenever i try to do anything with yum, say yum update, i get this
Code:
Error: Cannot retrieve repository metadata (repomd.xml) for repository:
InstallMedia. verify its path and try again the thing is i cannot find this in /etc/yum.repos.d or in the PackageKit thing.... what to do?
View 12 Replies
View Related
Mar 3, 2010
9.10 Bash shell.
Code:
Linux $ sudo source ./vars
sudo: source: command not found
Linux $ sudo . ./vars
sudo: .: command not found
[Code]....
View 8 Replies
View Related
Sep 12, 2010
i am getting this error after executing a command..i think my ubuntu is lacking some of the packages..can anybody tell me how to fix it..here is the description-->
$ apt-get source smplayer
Reading package lists... Done
Building dependency tree
[code]....
View 3 Replies
View Related
Nov 26, 2008
I have a config file that contains:
my.config:
Code:
Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.
Here is my parse_cmd script:
Code:
View 3 Replies
View Related
Jul 25, 2011
I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.
Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?
View 5 Replies
View Related
Jan 7, 2011
I am Vamsi from Alcatel-Lucent. We have a software to configure the wireless broadband devices to the Linux machine. Till now, it was running on FC-5. When we need to add any new device, we used to add it in airprime.c, sw.h and usb-serial.c under /usr/src/linux/drivers/usb/serial directoy.
Now we are trying to upgrade the system to FC-12. But I am not able to find any kernal files under /usr/src/kernels/2.6.31.5-127.fc12.i686.PAE/drivers/usb/serial directory. I saw in some websites that the kernal files can be found at: /root/rpmbuild/SOURCES/linux-2.6.31/drivers/usb/serial. But in my system, there is no rpmbuild directory.
View 4 Replies
View Related
Jul 15, 2010
I've just not long got things going and found that when I run updates or the software manager it says that it couldn't be found. My current source address is. [URL]
View 11 Replies
View Related
Aug 9, 2010
I'm using OpenSUSE11.2, and want to upgrade to OpenSUSE11.3 from internet. But there is not F4(Source) in boot menu. In my computer, F4 is keyboard menu. What shall I do?
View 1 Replies
View Related
Aug 11, 2010
I am trying to install ubuntu on an old machine and no matter what version I try to install I get this same error.
"No installable Kernel was found in the defined APT sources"
The versions I have tried are (9.04server. 9.10desktop, 10.04 server).
I have swapped both the CD drive and HDD drive becuase, well i don't know why, but I have. This didn't work.
I have read [URL] and have tried changing my BIOS settings so that i have my config is:
IDE Primary Master : Maxtor 6Y080L0 (HDD)
IDE Primary Slave : HL-dt-st-sl8480b (CD-DRIVE)
This didn't work.
I have also tried doing the instructions posted by migraineman on the second page of the thread mentioned above but this also didn't work.
My specs are:
Cyrix 6x86 Processor
80Gb Maxtor HDD
LG-GCE CD-ROM Drive
319Mb RAM - 8Mb Shared
View 4 Replies
View Related
Dec 1, 2009
Can any body tell me where can i found the source code for echo command. so that i can download it such that it can help me for further studies on echo command
View 8 Replies
View Related
Jun 28, 2010
I am trying to install NIC driver, at last when I am using command make the following output is coming. How to come out from this error:
Makefile:65 *** Linux source not found. Stop.
View 2 Replies
View Related
Jan 6, 2011
I am currently writing some convenience methods for my terminal in my bash_profile and am sure if what I am writing is "the best way". I figure a good way to verify whether what I'm doing is right or not would be to find some source code of more established programs and see how they do it.My question then is, where can I find this code on my Mac? An example is, with Macports installed, where is the source code that opens the port interactive console when I type nothing but "port" in my shell?(I added Linux in the title even though I am on a Mac because I assume the answer would be the same for both)
View 3 Replies
View Related
Mar 17, 2011
My question has to do with how environmental variables are passed from parent to child processes at the BASH SOURCE CODE level. I have a need to add an environmental variable that has the complete invocation line so that the child process can see it via ENVP.I have been studying the source for a quite a while and can't seem to find how to make the variable pass to the child. In EXECUTE_CMD.c I found a good place to set the variable: I made a routine similar to PUT_COMMAND_NAME_INTO_ENV called PUT_COMMAND_LINE_INTO_ENV which would add "?=THE FULL INVOCATION LINE" as an environmental variable but it doesn't make it to the child. (I've tried names other than '?' but they don't work either.
I'm thinking that there is either a LIST or a attribute associated with those environmental variables that should be passed to the child but I can't find it.
View 1 Replies
View Related
Jan 9, 2010
I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:
Let FILE="thefilenameofsomefilesfor_instance.txt"
Code:
NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`
I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.
View 5 Replies
View Related
Nov 9, 2010
I recently downloaded grub2 source code for my F13 installation and it compiled and installed perfectly, but when I rebooted nothing had happened and grub was still version .97. Is there something I didn't do?
View 1 Replies
View Related
Jul 25, 2011
I have made a full install of Slack 13.37.0. When I try to run the installer of the NVIDIA GF 8400GS card (NVIDIA-Linux-x86-180.29-pkg1.run) downloaded from [URL], I receive an error message. It says that the kernel source cannot be indetified/found. /lib/modules/2.6.37.6-smp/source and .../build links to /usr/src/linux-2.6.37.6-smp, which contains the full kernel source (can be compiled), including the header .h files in include/linux. The same NVIDIA installer can be run successfully on my previous Slack 11.
View 6 Replies
View Related
Apr 7, 2009
I am having problems installing fortran g95 compiler. I followed the exact instructions listed on the website The G95 Project (click on manual tab for further details), but I am still getting this error when I try using the driver:
shamo@linux-wrws:~> g95
bash: g95: command not found
Here is what I did:
>wget -O - http://ftp.g95.org/g95-x86-linux.tgz | tar xvfz -
The program installed properly, and I was able to verify the installation in /usr/share/g95-install. All the libraries were installed, and I was able to run the actual "executable" when I cd'ed to its directory) Next I created a symbolic link to the driver so that I could run from anywhere using g95 command:
>ln -s $PWD/g95-install/bin/i686-pc-linux-gnu-g95 /usr/bin/g95
Again I was able to verify that the link was created in /usr/bin. I also verified that /usr/bin was on my PATH using $PATH command.
View 7 Replies
View Related
Dec 25, 2008
what I should do to use apxs ?
View 2 Replies
View Related
Mar 10, 2011
tell me what does error message signify and what should be done to rectify it...bash : lex :command not found
View 3 Replies
View Related