Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Final Program:

#!/bin/bash
echo There are no guarantees on its actions.
echo For example it needs a limit on the number of files it opens.

project=$(basename "$0")
project=${project%.*}
length=${#project}

for fn in *; do
  ext=${fn#*.}
  file=${fn:0:length}

  if [ "$file" = "$project" ]
  then
    if [ "$ext" = "odt" -o "$ext" = "ods" ]
    then
      echo "$fn"
      libreoffice "$fn" &
    fi
  fi

done

Example: If you save it with the name

club files.sh

Double-click on it and it will open these files in the same directory:

club files.ods

club files.odt

club files spreadsheet 1.ods

club files spreadsheet 2.ods

club files document 1.odt

club files document 2.odt

It will ignore any files which don't start with "club files" or are not .odt or .ods files.

I hope someone finds it useful.

Final Program:script:

#!/bin/bash
echo There are no guarantees on its actions.
echo For example it needs a limit on the number of files it opens.

project=$(basename "$0")
project=${project%.*}
length=${#project}

for fn in *; do
  ext=${fn#*.}
  file=${fn:0:length}

  if [ "$file" = "$project" ]
  then
    if [ "$ext" = "odt" -o "$ext" = "ods" ]
    then
      echo "$fn"
      libreoffice "$fn" &
    fi
  fi

done

Example: If you save it with the name

club files.sh

Double-click on it and it will open these files in the same directory:

club files.ods

club files.odt

club files spreadsheet 1.ods

club files spreadsheet 2.ods

club files document 1.odt

club files document 2.odt

It will ignore any files which don't start with "club files" or are not .odt or .ods files.

I hope someone finds it useful.

Final script:script, I hope someone finds it useful:

#!/bin/bash
echo There are no guarantees on its actions.
echo For example it needs a limit on the number of files it opens.

project=$(basename "$0")
project=${project%.*}
length=${#project}

for fn in *; do
  ext=${fn#*.}
  file=${fn:0:length}

  if [ "$file" = "$project" ]
  then
    if [ "$ext" = "odt" -o "$ext" = "ods" ]
    then
      echo "$fn"
      libreoffice "$fn" &
    fi
  fi

done

Example: If Check that all the files you save it want associated with the project and opened at the same time start with the same name

club files.sh

and are .ods or .odt ones. Save the script into the directory with the same name, give it the executable property.

Double-click on it and it will the script to open these files in the same directory:

all the files but no others, example:

club files.sh

club files.ods

club files.odt

club files spreadsheet 1.ods

club files spreadsheet 2.ods

club files document 1.odt

club files document 2.odt

It will ignore any files which don't start with "club files" or are not .odt or .ods files.

I hope someone finds it useful.

Final script, I hope someone finds it useful:

useful:
    #!/bin/bash
 echo There are no guarantees on its actions.
 echo For example it needs a limit on the number of files it opens.

opens.

project=$(basename "$0")
project=${project%.*}
length=${#project}

for fn in *; do
  ext=${fn#*.}
  file=${fn:0:length}

  if [ "$file" = "$project" ]
  then
    if [ "$ext" = "odt" -o "$ext" = "ods" ]
    then
      echo "$fn"
      libreoffice "$fn" &
    fi
  fi

done

Check that all the files you want associated with the project and opened at the same time start with the same name and are .ods or .odt ones. Save the script into the directory with the same name, give it the executable property.

Double-click on the script to open all the files but no others, example:

club files.sh

club files.ods

club files.odt

club files spreadsheet 1.ods

club files spreadsheet 2.ods

club files document 1.odt

club files document 2.odt

Final The final script, I hope someone finds it useful: useful:

#!/bin/bash
 echo There are no guarantees on its actions.
 echo For example it needs a limit on the number of files it opens.

opens.

project=$(basename "$0")
project=${project%.*}
length=${#project}

for fn in *; do
  ext=${fn#*.}
  file=${fn:0:length}

  if [ "$file" = "$project" ]
  ] ; then
    if [ "$ext" = "odt" -o "$ext" = "ods" ]
    ] ; then
      echo "$fn"
      libreoffice "$fn" &
    fi
  fi

done

Check that all the files you want associated with the project and opened at the same time start with the same name and are .ods or .odt ones. Save the script into the directory with the same name, give it the executable property.

Double-click on the script to open all the files but no others, example:

club files.sh

club files.ods

club files.odt

club files spreadsheet 1.ods

club files spreadsheet 2.ods

club files document 1.odt

club files document 2.odt

The Thanks mjjzf and w_whalley for stimulating my thought processes. Here is the final script, I hope someone finds it useful:

#!/bin/bash
echo There are no guarantees on its actions.
echo For example it needs a limit on the number of files it opens.

project=$(basename "$0")
project=${project%.*}
length=${#project}

for fn in *; do
  ext=${fn#*.}
  file=${fn:0:length}

  if [ "$file" = "$project" ] ; then
    if [ "$ext" = "odt" -o "$ext" = "ods" ] ; then
      echo "$fn"
      libreoffice "$fn" &
    fi
  fi

done

Check that all the files you want associated with the project and opened at the same time start with the same name and are .ods or .odt ones. Save the script into the directory with the same name, give it the executable property.

Double-click on the script to open all the files but no others, example:

club files.sh

club files.ods

club files.odt

club files spreadsheet 1.ods

club files spreadsheet 2.ods

club files document 1.odt

club files document 2.odt