The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
123 views

Extract file name from find command

I am trying to extract the file name and attaching to mail. But when I send mail the attachment is coming with path name and file name. Ex: dir=/home/as123/bill and filename=abc.pdf.Z and I am ...
1
vote
2answers
90 views

Problems with basename in a loop

I am new at shell script programming and I'm trying to execute a software that reads a text and perform it's POS tagging. It requires an input and an output, as can be seen in the execute example: $ ...
2
votes
1answer
168 views

Remove multiple possible suffixes

Example: I want to create a quick command to shrink images (for my filebrowser). ... FN="/tmp/some-image.jpg" gm convert "$FN" -resize 50% "$(dirname $FN)/$(basename $FN .jpg/png/gif).jpg" ... How ...
3
votes
4answers
603 views

Use basename to parse a list of paths held in a file

I'm running Mac OSX and trying to use the command line to find the number of files I have with the same name. I tried to use the following command: find ~ -type f -name "*" -print | basename | sort ...
1
vote
1answer
1k views

Basename gives extra operand error

I 'm using the following script to merge few pcap files into one using mergecap command. But when I run it it gives me a 'basename: extra operand /mnt/md0/capture/DCN/dcn_2014_02_04_00_11_47_598.pcap' ...
22
votes
3answers
653 views

shellcheck is advising not to use basename: why?

I am trying out shellcheck. I have something like that basename "${OPENSSL}" and I get the following suggestion Use parameter expansion instead, such as ${var##*/}. From the practical point of ...
1
vote
2answers
2k views

Bash shell scripting basic question regarding the syntax and basename

Consider the script below: myname=`basename $0`; for i in `ls -A` do if [ $i = $myname ] then echo "Sorry i won't rename myself" else newname=`echo $i |tr a-z A-Z` mv $i $newname fi done ...
2
votes
2answers
699 views

Inner function call with xargs parameters

I am trying to create a file occurent within my /tmp directory of each file containing a speicific string. The problem is that the call to basename {} does not seem to work. Neither this, neither ...
3
votes
5answers
3k views

Execute on the basename of a find command

Suppose I have a directory structure as follows test test/a test/b Now I want to execute a command, such that in the . folder I can execute a command on the basename of the files a and b. So ...