Programming :: Remove Line Containing Certain Variable - Bash - Permission Denied?
Jul 20, 2011
I am writing a bash script to run everyday and output results to a file. When the same results are produced i want to overwrite the line from the previous day. (Or remove and add). So if the script finds a variable in a line. i want it to output the results to that line . sed -i did not work for me; sed: couldn't open temporary file ./sedTvOCEg: Permission denied
View 10 Replies
ADVERTISEMENT
Jul 25, 2011
I'm using sed to remove certain line in a text file based on a match with 2 variables from input. Here is how it looks like in file
Philip S:Odds:45:343
Mike Junior:Odds:3:56
I prompt for 2 inputs in variable form which is compared to the first 2 fields of the above text (: seperated). So say i enter Philip S and Odds then it should delete the entire first line.
View 4 Replies
View Related
Mar 27, 2010
I tried to execute the following command: $ ./eval_online_wiki.ml -db_user aa -db_pass bb -db_name cc It returned as follows: bash: ./eval_online_wiki.ml: Permission denied What does this mean? How to solve the problem? Actually, I was following a README, and it says "$ ./eval_online_wiki -db_user <username> -db_pass <pwd> -db_name <db_name>"
View 2 Replies
View Related
Jan 2, 2009
I'm trying to run a backup using CPIO to an LTO2 tape in an HP Ultrium 460 drive using the following:find / -path /proc -prune -o -print | cpio -o -H crc --block-size=128 > /dev/st0Each time I get the error:-bash: /dev/st0: Permission deniedThis is regardless of whether I sudo the two sides of the command or not. I have used dd if=/dev/st0 of=/tmp/test.file ibs=128k count=1 to verify the blocksize (and since I was a little confused about block-size in cpio I also tried --block-size=256)
View 5 Replies
View Related
Sep 24, 2010
trouble when I log in the fedora as a normal user(not root) today. When I fill the username and the password press enter key. Then pop up a little window locate at topleft corner. And have one line message : "/usr/bin/xterm : Could not exec /bin/bash : Permission Denied"hen I log in as root, it's ok. And when I open shell and type "su username" then the console print "su: /bin/bash: Permission denied"I have checked the perms of "/bin/bash" , it's 755. And I have tried all things which suggested from articles searched through Google. like change / or /root and other directory's permissions but failed
View 4 Replies
View Related
Sep 10, 2010
If I run this as su I get the same thing. If I log on as root user It is the same as well
View 5 Replies
View Related
Aug 24, 2010
[root@mail tmp]# ./PE1650_RAID_FRMW_LX_R168387.BIN-bash: ./PE1650_RAID_FRMW_LX_R168387.BIN: Permission deniedalso get it when trying to run[root@mail tmp]# ./ESM_FRMW_LX_A37_R117418.BIN-bash: ./ESM_FRMW_LX_A37_R117418.BIN: Permission denied
View 2 Replies
View Related
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
Jun 16, 2010
I have installed it++ on suse11.2 I have downloaded an example project and everytime i try to "make"..error "/bin/sh: line 1: .dependencies: Permission denied" comes up.I have tried to run as root but this hangs on "checking dependencies" and gives no action.
View 2 Replies
View Related
Aug 10, 2010
I've been using Digikam and it's a huge blow to my system memory. Even after quitting I still feel my computer to be slightly slower. I tried running the commands from [URL] but I get this instead
bash: /proc/sys/vm/drop_caches: Permission denied
View 4 Replies
View Related
Dec 16, 2009
Firstly, i'm NEW to Linux and my very first time with DSL. I'm installing this on an older Dell Latitude laptop.
I just finally got the DSL installed on my HDD successfully and then I added feh to start and run at start up, then I rebooted and now i'm getting this error:
No, directory, logging in with HOME=/ -bash: cd: /home/dsl: Permission denied
I have tried reading numerous websites but none explains to the level whereby I can understand. I even tried rebooting from the CD, but could not figure out how/what to do next?
The question is, can someone explain how I can use the DSL CD to try to correct this error. More importantly, can you explain in layman terms so that I can actually put it good use.
Also, some additional questions I have....when you download a file where does it save to?
View 6 Replies
View Related
Sep 24, 2010
I'm in trouble when I log in the fedora as a normal user(not root) today. When I fill the username and the password press enter key. Then pop up a little window locate at top left corner. And have one line message : "/usr/bin/xterm : Could not exec /bin/bash : Permission Denied" Then I log in as root, it's ok. And when I open shell and type "su username" then the console print "su: /bin/bash: Permission denied" I have checked the perms of "/bin/bash" , it's 755. And I have tried all things which suggested from articles searched through Google. like change / or /root and other directory's permissions but failed.
Code:
[root@localhost lib]# ldd /bin/bash
linux-gate.so.1 => (0x00687000)
libtinfo.so.5 => /lib/libtinfo.so.5 (0x05846000)
[code]....
View 2 Replies
View Related
Sep 9, 2011
I have tried changing permissions and I have looked for a solution, but the error still exists.In fact it gives me a different error every time I log in.
Could not chdir to home directory /home/rb27: Permission denied
here is a snippet of what I get when I use the command ls -al:
drwxr-xr-x 16 root root 0 Sep 8 18:28 .
drwxr-xr-x 23 root root 4096 Feb 5 2011 ..
d????????? ? ? ? ? ? ajd74
d????????? ? ? ? ? ? ban45
d????????? ? ? ? ? ? rb27
I cannot log in as root since the permission is denied
View 1 Replies
View Related
Jul 11, 2010
Code:
[serv@local subsys]$ rm -rf nagios
rm: cannot remove `nagios': Permission denied
[code]....
View 2 Replies
View Related
Jul 25, 2011
I want to insert a line at a particular line number using sed or awk. where line number is not fixed and is in form of variable.
I want to use variable in sed or awk command.I tried something like below, but no luck.
View 7 Replies
View Related
Nov 5, 2009
I have tried to mount Sda on my laptop HP dv6 and I have got this problem [root@cpe-74-71-125-175 ~]# /dev/sda1 /mymount/win ntfs-3g rw,umask=0000,defaults 0 0 bash: /dev/sda1: Permission denied
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
Mar 9, 2011
I've just recently started learning shell scripting and I've been working on a basic csh script, but I've been having a few problems. Here's the script
Code:
#!/bin/csh
echo Enter a file name
$< = FILE ##Name of file
echo enter a size (in kilobytes) to monitor
SIZETOMON = $< ##Size value that's input by user
du -k $FILE = $SIZE ##Size of the file that the user wishes to monitor
while (1)
if $SIZE > $SIZETOMON then
echo ALERT: File size is greater than $SIZETOMON
end
And here's the output
Code:
/home/lucer/foo.txt: Permission denied.
Badly placed ()'s.
I'm not really sure what the issue is with the "badly placed ()'s" or why it won't let me access files that I can access with the same shell when it's not in a script.
View 14 Replies
View Related
Mar 18, 2009
I have a written a java code to ftp a file from the windows box to unix box. It keeps giving me the following error : "java.io.FileNotFoundException: PORT 204,63,56,5,16,78: 550 Permission denied." I am able to ftp manually from windows to unix.
View 5 Replies
View Related
May 3, 2011
In user mode [non-root] linux machine, tried to bind a socket by using a"ioctl(iInterfaceSocket, SIOCSIFADDR, &stCommand)". I am getting error 13 -> Permission denied because of user mode. If change from usermode to kernel mode everything works fine.I need to bind the socket in user mode only, please suggest solution for the abovewhile explaining the above,
View 2 Replies
View Related
Nov 26, 2010
Code:
# 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
View 4 Replies
View Related
Mar 25, 2011
I have beat this enough and don't get what should have been a very simple thing to do. I build a variable;
Code:
CLIST=java,lua,python,php,perl,ruby,tcl
CLIST will be used by another bash script but I need to replace the commas with a space. I
[code]...
View 2 Replies
View Related
Sep 12, 2010
I currently have 3 files with floating point data that I wish to have in a single file with the format:
Code:
F1 F1 F3 Output
a1 b1 c1 a1 b1 c1
a2 b2 c2 a2 b2 c2
a3 b3 c3 a3 b3 c3
a4 b4 c4 a4 b4 c4
View 3 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
Jul 7, 2011
bash 3.1.17(2) I'm trying do write a shell script which must operate on each line of an ASCII text file. So, all the code must be inside a loop, and inside the loop, the first thing should be to read the next line from the file. I have the bash read command. But it reads from stdin. Any way to make read from a file?
View 6 Replies
View Related
Mar 8, 2011
I have a set of files containing data that I need to re-arrange into one single property list.
The files that I have look like this:
Code:
# cat uk
<string>10</string>
<string>11</string>
...
<string>29</string>
[Code]....
So the lines in the files match up but I haven't found a way of reading several files line by line.
View 3 Replies
View Related
Aug 18, 2010
I'm trying to make another file annotation script a little speedier than it has been by the up-until-now proven method of checking the last four characters in a filename before the "dot" (eg .jpg, .psd) against a list of known IPTC categories and Exiv2 command files. It occurred to me that if one script generated a list of files in directory foo, and the same or another script sorted that list by that four-letter tag,then that list could be used(instead of a for/do/done loop on the real files in the folder) by the command-file-matching script to "vomit out" which annotator file would go with file nastynewfile.jpg, f'r'instance. The script I had been using for this task looks like this:
Code:
while read 'line';
do
sp=$(echo $line)
vc=$(echo $sp | cut -d"," -f1)
cv=$(echo $sp | cut -d"," -f2)
[code]....
Where I seem to be stuck is with how to sort the lines in templist, which may be any number of different lengths, from back to front. sort -k looked promising, except it seems only to work the other way round. I thought of invoking a
Code:
q=$(expr length $line); echo $q
n=$[q-8]; echo $n
kind of thing, but that presented the problems of how to sort by those, how to tell sort where to find them (grep?) and how to "stitch them back in" to the original list, which is what I want to sort in the first place.
View 14 Replies
View Related
May 5, 2010
I tried posting this before and I'm not sure what happened but I don't think it worked, so if it did please forgive the double post.am very very new to centOS and linux in general. I just want to setup a test web server that more closely mirrors our actual web server that is hosted by rackspace. I've installed centOS and tried to setup Apache, PHP and MySQL from a guide on the web using Yum. When I go to localhost in the web browser I'm able to see the default apache page. However when I create a php page it's just blank.When I look at the apache error logs I get this: PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
I've been searching alot on the internet and I know the issue is permission related, but I don't know how to fix it. I've seen some forum posts that say you need to use the chmod 775 command on the /var/www/html folder.Currently when I do ls -l /var/www/html it returns
-rw------- 1 root root 19 May 5 13:16 index.php
-rw------- 1 root root 19 May 5 13:15 index.php~
I'm sure that this isn't correct but like I said I don't know much about how to set permissions or who the owner needs to be. I've done alot of searching and seen similar posts, but no one seems to explain it clearly.
View 2 Replies
View Related
Feb 17, 2011
Just a simple BASH for loop to read the file path from a text file (clean.txt) echo the variable for debug purposes, and scp it to a server I have using port 50 for SSH.
I've already formatted the entries in clean.txt to handle spaces correctly, using sed replacement.
Example from the clean.txt file:
Code:
/MP3/NAS000000001/Barenaked Ladies/Barenaked Ladies - Barenaked For The Holidays/20 Auld Lang Syne.mp3
/MP3/NAS000000001/Barenaked Ladies/Barenaked Ladies - Barenaked For The Holidays/14 Deck the Stills.mp3
[Code]....
View 5 Replies
View Related
Feb 16, 2011
I want to write a c program with some shell scripts.Now For a simple C program. I am Setting a variable called val2 in bash, now I want to use bash variable val2 in C code. How do I do that?The above doesn't work (coz its spawning a different memory space and when shell script ends the variable dies with it as per my research but how do I keep them in same memory space)Also Is there any Good reference where they teach how to integrate C and Bash Together?
View 5 Replies
View Related