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.
I have a number of text files throughout my /home/pjs/Documents directory tree that have execute permissions set. Almost all of my file names have spaces in them. I am trying to write a shell script that will look at each file in my Documents directory, find the ones that have execute permissions set, and run the command chmod 644. Of course, I don't want the command run on the directories.
The following script *doesn't work*, but might serve to illustrate what I am trying to do:
#!/bin/bash for x in "$(ls -R)" do if [ -f "$x" ] && [ -x $x ]; then chmod 644 "$x" fi done
I want each file and directory name to be placed, one by one, in the variable $x, and then tested with the "if" conditionals.
The first problem seems to be that, although the command "ls -R" does produce a complete list of the files and directories I need, they are not placed, one by one, in the variable x like I want them to be.
Also, I think I should use the shift command so that the option -R doesn't get included as one of the values of the variable $x, but I can't figure out where to put it.
trying to learn how to write a bash script that will create a new text file named jimbola in my home directory. The file will need to be able to have the first and last name of Jim Bola included in it.
When I ls -l /etc/passwd, -rw-r--r-- 1 root root /etc/passwd When I login as myself, and rm /etc/passwd, it asks: rm: remove write-protected file '/etc/passwd'? If I say yes, will it actually delete the passwd file?
df -h [URL] I did the following command to find everything is in /usr or /var, then tracked it down to /usr/lib and /usr/share as the main offenders, but out of all the directories none are more than 1mb or so.
du -sh /* | sort -gr | head -n 5
I tried to uninstall firefox, which is what got me in this mess in the first place, the log claims it will remove ~240 mb but failes on a "E: Write error - write (28 No space left on device)" [URL] If I could juggle something onto an external hard drive so I can uninstall firefox I would be out of the wood. Failing that I believe a new install is in order.
I open an ODS file and edit it and save, fine. But sometimes and for no readily apparent reason it refuses to save the document with the error message:"Error saving the document <filename>: Write error. The file could not be written". I have upgraded my version of OpenOffice but the issue remains. Once it starts with that error the only way to save the file is to actually abandon my change and restart OOffice. Today I lost an hours stuff as the auto save was also failing but not giving me any warning it was failing. I'm not sure if this is an OpenOffice, file system, Fedora or permissions issue though I've not noticed anything similar with other applications. Have set permissions to 777 but still get the error.
I have tried for some time to write an .img file to a USB and a SD Card to boot from to my Netbook. The .img file is from Moblin and they suggest that I use Win32 Disk Imager to write the file to my USB. Though it haven't worked for me even if i use the SD Card and other computers.
The easiest for me would be if i could write the .img file on my SD Card and i have search for some tutorials but haven't found a way to write the file.
I've read something about "dd" but don't get the "command", "code" - thingy. If any one know an easy tutorial for it would be great! Or even better would be a tip to another program/utility like the Win32 Disk Imager that works.
I Use a Windows 7. HP Pavilion Elite and a Windows XP. Compaq Mini 110
I'm writing a script/plugin for Nagios for testing a WebLogic server.. I redirect some output to a file, and then i read that file to get some data, but i can't seem to write to that file with my script :s... this is the most important code
* EDIT * When i execute this script through a local terminal (PuTTy), it works but when i execute it from Nagios, it doesn't work..
I want to backup my Ubuntu box and I found a couple very helpful articles that describe how to use tar for backup and restore. So far so good. I've dabbled in Lin/Unix in the past, mainly on work systems, but Linux on my personal PC is new to me.
When I ran the tar command as root (su -) I noticed several errors scrolling by in the window. It's scrolling too fast to note the exact errors, but I did notice "permission denied" a few times.
Is there some way that I can capture the output of the tar command to a file so I can review it for errors and/or permission denied statements?
Can I just add some arguments to tar?
tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /
I have created a file newfile.txt using: touch newfile.txt Now I want to write to that file from terminal i.e whatever I will type after the $ will be written to the file this is what I want. How can I do that?
I have the following problem. I call a C++ program from a Java servlet by using Runtime exec. The OS is ubuntu and I use Netbeans 7.0 with Glassfish 3.1 web server.The program executes but it does not open and write into a specified file in a specified folder. The same C++ program compiled under Windows opens and writes this file.How can I solve this problem in Linux?
On Monday i had Centos 5.3 with / and /home in ext3, with no problems (at least i don't remember any problem).But as I decided to use XFS (I have a SSD , and i use a 3D Modeling software called Maya , that it's quite sure it could take advantage of use XFS), i decided to create in my new Solid State Disk , that i recently bought , a swap , a / partition formated in XFS , and a /home partition in XFS too.Then I used a Live cd to copy the contents from the old HDD to the new SSD , using find and Rsync --> (cd /mnt/oldroot/ ; find . -xdev -print0 | rsync -avHx --exclude-from /mnt/rsync-filter . /mnt/newroot/)
Once done , i edited fstab,Menu.lst , install grub in the MBR and i had to use mkinitrd to load the XFS.ko so be able to boot with the new system.All worked fine , although i only could log with the root , my normal user could not log , and a error appeared : GDM could not write your authorization file.This could mean that you are out of disk space or that your home directory could not be opened for writing.In any case it is not possible to login. Contact system administrator.But i remember that prior to Copy all to the new SSD , and use XFS , all was fine, and i was able to log with my user.
So thinking that perhaps the copy did by Rsync was not ok , or something i decided to reinstall Centos, now in a partition in my SSD and try another time , but without using a /home partition neither a normal user ,only using root.The SSD had a Swap , a 32 GB XFS partition and the / of the new Install in ext3 (20 GB ).Once installed Centos 5.3 , I updated only Glibc , yum and Python packages (like said in Centos 5.4 Release notes recommends , but not doing the final yum update)Then i updated only the kernel , to have a XFS supported Kernel , and then i rebooted (I would update all once migrated to xfs)
I am trying to change the write permissions on a file and On the screenshot you will see where i have underlined, its states i dont have owner rights to modify this file, how do I get owner Permissions when this is my installation..
I'm running a simple backup and log script that is cronjobed to run twice a day. So currently, when new data is added to the log, its added to the direct bottom of the log file. However, I would like to have it printed to the very top of the log. The code is attached, I can't quote it in here because I am a new user and the system thinks I have url's in it, when they are just paths.
I am trying to write a C++ Code to read write a XML file in C++.I researched a lot and find xerces is used for that but I am not able to write the code for that.Please provide me some links on how to run a code that R/W a xml file in C++.
I need to copy a file into a Flash memory which is connected to my computer via USB. The file must start at a specific sector. Can anyone guide me how to do this? (it can be through a C program, a line command, or any other way)