General :: Shell Script - Make Dirs Filename

Jun 27, 2010

Trying to write a shell script called make to read a file called dirs with the following in it
programs
scripts
documents
Read file line by line and make the directories in the current directory when you type ./make dirs if no file is given then program should print usage:
make dirs filename

View 3 Replies


ADVERTISEMENT

General :: Shell - What's The Difference Between Filename And ./filename

Apr 23, 2010

What is the difference between filename and ./filename? Under what circumstances is one preferred to the other?

View 5 Replies View Related

General :: Make A Variable = Filename Without The Extension?

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

General :: Set A Pattern That Will Output A Filename Equal To The Original Filename In SoundConverter?

Jan 23, 2011

$ uname -a
Linux a 2.6.35.10-74.fc14.i686.PAE #1 SMP Thu Dec 23 16:10:47 UTC 2010 i686 i686 i386 GNU/Linux
$ lsb_release -a
LSB Version: :core-4.0-ia32:core-4.0-noarch

[Code].....

How can I set a pattern that will output a filename equal to the original filename? E.g.

something.mp3 → something.ogg

And why isn't this implemented in SoundConverter?

PS: {Filename} doesn't work.

View 1 Replies View Related

General :: Shell Script Has Stopped Working - Why Is "" Appended To Filename And Does It Matter

Jun 8, 2011

I am new to Linux, but was put in charge of our company's Amazon presence. My problem is that all of the sudden, a shell script we have been using has stopped working, and returned an odd error that I simply can't decipher. The shell script is pretty simple, and is run on our crontab (however manually running it causes the same error as well). The script name is "sendh.sh" and to run it in Linux is simply typing "sh sendh.sh". Here it is:

[Code]....

Yes, obviously those files are in the directory, I can see them through the "ls" command (or through WinSCP as well). When run one by one, each command works fine, it's just when using this "sendh.sh" shell script then it fails. Does anyone know why "" is appended to the filenames when I try to run it, or what the heck "ambiguous redirect" means?

View 11 Replies View Related

General :: Bash Dirs Command And +N Option?

Feb 8, 2011

I'm trying to use the dirs command with the +N option. The manual says: dirs [-clpv] [+n] [-n]Without options, displays the list of currently remembered directories. The default display is on a single line with directory names separated by spaces. Direc- tories are added to the list with the pushd command; the popd command removes entries from the list. +n Displays the nth entry counting from the left of the list shown by dirs when invoked without options, starting with zero.

dirs -v shows:
0 /dir1/
1 /dir2/
2 /dir3/

However, dir +n 1, dir +N 1, dir -v +n 1, dir -v +N 1 all give:

[Code]...

View 2 Replies View Related

General :: How To Find Root Files And Dirs In Some Dir

Oct 31, 2010

For example I have "/some/dir" which contains user's files and directories. I want to check if there are any files or directories of root. I guess I should use "find" command but what's the full command to find it out?

View 2 Replies View Related

General :: Need For Loop To Get Dirs And Run Bash Script

Jul 7, 2010

I have to format 4 years worth of awstats data "static" for a client and then move it to their new server.I don't want to run the commend to do this 48 times. If possible I would like to use a bash script that uses the folders in a directory so the script knows which year-month to do this for me and which folder to place the output in.

View 5 Replies View Related

General :: Make A Shell - Using Mail Command DestMail= Cat

Jul 22, 2011

I have a problem to make a shell, using mail command DestMail= cat /opt/scripts/maillist.txt mail -s"SUBJECT" $DestMail -- -r xxxxx@gmail.com < /opt/scripts/test.txt where: maillist.txt contain email adresse separated by comma test.txt mail text this script can eval DestMail variable!!

View 1 Replies View Related

General :: Calling A Shell Script To Make Few Builds

Jul 27, 2011

I am setting up a cron job, where i am calling a shell script to make few builds. I got struck at a point, need some expert inputs to proceed further. The script is categorized in 5 parts and in the last part while building software it asks for few questions like:-

1. Build mode choice
2. normal build
3. Copy Images
4. Arch

User manually has to input ans for these questions:-
1
yes
n
64

The ans's are fixed and this won't change. How shall i hard-code them or do something in the script so as when script flow reaches to this point it automatically take's these value. So far the cron job is not getting completed as it's waiting for user to key in these values manually. I had faced similar issue while building kernel modules but there it was easier as i had to take default values always:-

View 2 Replies View Related

General :: Building Application In Shell Using Make Command

May 26, 2011

Consider that I am building my application in Linux shell using make command but somehow the build fails. Is there any way I can find out that the build has failed (of course looking at shell for error messages will do the job for me but I don't want that). Is there any flag make or shell will set/reset if such failure occurs ?

View 5 Replies View Related

Server :: Split A Filename Into Its Filename And Extension?

Apr 6, 2010

I need to split a filename into its filename and extension, so I can append a datestamp to the filename. I'm using bash.

View 8 Replies View Related

CentOS 5 Hardware :: How To Compile Filename.c Into Filename.o

Nov 20, 2009

I've installed ethernet adapter, it is made in china from a manufacturer called FOX. The driver for that adapter is supported for sco linux kernel version 2.4.x and 2.5.x .However, I'm using Centos5 but the OS didn't recognize the adapter alone, so I'm trying to follo instructions on the driver on the attached CD.

The CD contains file named "SC92031.c", the instructions tell me to do the following "Compile the driver source files and it will generate sc92031.o"

View 8 Replies View Related

General :: Command For Listing Files/dirs Recursively Of Specific Directories?

Jul 22, 2011

suppose in my current directory, I have 50 sub-directories. Now, I am interested only in about 20 of those sub-directories (whose names match a pattern). I would like to recursively list the contents of these 20 sub-directories. How do I do that ? I would like to do this in Solaris 10 and Linux(RHEL 5.x).

View 3 Replies View Related

General :: Make My Computer Beep Using Terminal Shell Script?

Jul 31, 2010

I have a laptop running Ubuntu 10.04 and i want to make a shell script and I want a beep sound but I can't get one..

I tried this and i didn't hear any beep

View 4 Replies View Related

Programming :: Makefile - Error When Run The Make Run - No Rule To Make Target - Shell.h

Sep 15, 2010

I want to gave much details as possible. working directory (~/a1/shell) in the shell directory i have Makefile. also in the shell directory i have subdirectory's (obj, src, include)

My current Makefile

Quote:

#What needs to be built to make all files and dependencies

clean:

# End of Makefile

I wanted it so: all .o files are created in the obj subdirectory, and my application, sshell, is created in the shell directory.

I am getting this error when i run the make run: No rule to make target 'shell.h', needed by 'shutil.o'. stop

View 1 Replies View Related

General :: Make Shell Script Wait For A Particular Key Pressed In Order To Proceed?

Jan 30, 2010

i've been searching all over the internet for a way to let the user press a particular key let's say 'y' without the user having to press [Enter] as confirmationfor yes, this would then run another function.

Quote:

Book Inventory Summary Report:-

Title, Author, Price
______________________________
StarWars EP1, G.Lucas, $49.59
Harry Potter, Rowling, $45.98
The Matrix, Mr. Smith, $53.98

Press 'y' to make a copy of this result into a file or 'n' to return to the main menu.. I understand the "press any key to continue" would go something like

Code:

read -sn 1 -p "Press any key to continue.." But i try many different ways of getting the "press a particular key" function, and none of them works.

View 5 Replies View Related

Ubuntu :: Cannot Make And Make Install In Gnome Shell?

Jun 20, 2011

I just installed Gnome Shell in Ubuntu 11.04 through UGR Linux and everything works fine! The only problem is that I cannot run make and make install. I get the following errors:

Code:
alexandros@Autobot:~/gnome-shell/source/gnome-shell-extensions$ make && make install
Making all in extensions
make[1]: Entering directory `/home/alexandros/gnome-shell/source/gnome-shell-extensions/extensions'[code]........

View 3 Replies View Related

Software :: Difference Between <filename>.rpm And <filename>.src.rpm?

Nov 22, 2010

what is the difference between <filename>.rpm and <filename>.src.rpm?

View 2 Replies View Related

Programming :: Convert A Dynamic Library (filename.so) To A Static Library (filename.a)?

Nov 18, 2009

How can we convert a dynamic library (filename.so) to a static library (filename.a) using gnu gcc . Can we get a static library form a dynamic library . I saw a few post in which the conversion form a static library to a dynamic library is mentioned but, unfortunately, not the other way.

View 4 Replies View Related

General :: Get Substring Of Filename?

Oct 28, 2010

i have filename like the following

1_40_37573.dbf
1_41_37573.dbf
1_42_37573.dbf

[Code]....

actually i want to extract the substring between 2 underscores
e.g. in case of 1_40_37573.dbf i need 40 and in case of 1_101_37373.dbf i need 101 and so on

View 8 Replies View Related

General :: Create A .tgz With The Filename?

Apr 21, 2011

I have some school work that involves creating a script that creates a backup of my /home folder, everything goes well but the problem is with the filename.

I am supposed to create a .tgz with the filename : hostname-day-date-HH:MM:ss.tgz

The .tgz gets created with the correct filename but when I try to unpack it the filename can't be resolved, it's the : that mess things up.

View 2 Replies View Related

General :: Can Source Filename Be Used In Makefile

May 7, 2010

in directory a_dir, have a file named a_file.i can type "source a_file" under directory a_dir and execute successfully.but if i write the command to a Makefile under directory b_dir, the "source" function can't be executed well. it will generate some error message like this:

./a_file: line 1: setenv: command not found
./a_file: line 2: setenv: command not found
./a_file: line 3: setenv: command not found
./a_file: line 5: setenv: command not found

View 3 Replies View Related

General :: Extract Last Number From Filename

May 27, 2010

I have to extract last number from filename.

ex- my file name is a10b8c1000

so i want to extract 1000 from it.

i tried using sed
sed 's/[a-z][0-9]*[a-z][0-9]*[a-z]//g' a10b8c1000

but sed looks for content inside file.

View 8 Replies View Related

General :: Remove A Part From A Filename?

Feb 25, 2011

I would like to remove a part from wiz_khalifa-black_&_yellow-(82_bpm).mp3
The part to be removed is -(*_bpm)

so that makes wiz_khalifa-black_&_yellow.mp3

Also a problem is that sometimes multiple "(" occur in a filename (wiz_khalifa-black_&_yellow-(remix)-(82_bpm)), so how can i only remove from the last "("

View 11 Replies View Related

General :: Replacing Part Of Filename?

Apr 25, 2010

I have just re transcoded a bunch of avi's. to tell the new ones from the old ones I put '[xvid]' at the end of all the new avi's. but now I have deleated the old avi's I want to remove the [xvid] part of the file name. This is what I have so far

Code:
#!/bin/bash
for name in *.avi
do
newname=`echo "$name" | tr -d [xvid]`

[Code]...

View 10 Replies View Related

Ubuntu :: Removing Parent Dirs From Tar

Jul 30, 2011

I'm trying to use tar which I've used a bit before but have never had to do this so I'm unsure. I'm trying to remove parent dirs from the backup. example;

Code: tar cvpjf /path/to/backup.tar.bz2 /path/to/the/source I want the backup.tar.bz2 to only contain the contents of source. At the moment the contents of the backup.tar.bz2 have the following file structure /path/to/the/source/files. How can I remove the parent dirs from the backup.tar.bz2? Alternatively, How could I just extract the contents of source with out the above folder structure? at the moment when I extract the backup.tar.bz2, I get the full folder structure in the location that I extracted it to.

View 2 Replies View Related

Programming :: C- How To Skip Dirs That Are Mounted Twice

Aug 27, 2010

I need to list a directory recursively but I want to skip subdirs that were already mounted. There are 2 cases:

a) a filesystem was mounted twice, like in this example:

- "/dev/sda2" was mounted on "/mnt/mnt_point1"
- "/dev/sda2" was mounted on "/mnt/mnt_point2"

I want to list "/mnt" but descend only in "/mnt/mnt_point1"

b) part of the file hierarchy was remounted somewhere else, with "mount --bind":

- "mount --bind /home/user/tmp/test /home/user/tmp/mounted_test"

I want to list "/home/user/tmp" but descend only in "test" "statfs" and "statvfs" don't offer any information to discern if a dir was mounted twice. One solution would be to read "/etc/mtab" (as "find" command does it) and perform some checks, but I think that this is pretty expensive (one has to read /etc/mtab every time one encounters a dir; if this file is read only when program starts, a mount could occur in between reads, so that the program will be inaccurate). Another solution would be to filter kernel events (via libudev or Netlink) and do this reading of /etc/mtab only when a MOUNT event was issued.

View 1 Replies View Related

General :: Rsync Directories By Path / Filename Only?

Aug 22, 2010

Is there a way for me to rsync two directories comparing only filenames (and not file size, date modified, or any other criteria)?

View 2 Replies View Related

General :: LS Hangs On Searching For Filename In Directory

Oct 19, 2010

I have a directory that has a large number of files, around 1.5 million at this point. If I go to the directory and type in "ls filename" for a filename that I know exists, ls just hangs. I have let it run for over 20 minutes and it never does anything. Up until yesterday the directory was working fine through samba serving up files, but now it doesn't return anything. How to proceed from here?

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved