Skip to content

Instantly share code, notes, and snippets.

@justsh
Created August 31, 2024 07:55
Show Gist options
  • Select an option

  • Save justsh/d9f987df794d29a96e58b483bae8f54b to your computer and use it in GitHub Desktop.

Select an option

Save justsh/d9f987df794d29a96e58b483bae8f54b to your computer and use it in GitHub Desktop.
Changes the fileInfo license line in Maya ASCII files from "education" to "student"
#!/bin/bash
main() {
usage="${FG_CYAN}usage: removeStudent filename.ma${NORMAL}"
if [ -z "${1}" ]; then
echo -e "${FG_RED}Filename not given${NORMAL}"
echo -e ${usage}
elif [ ! -e "${1}" ]; then
echo -e "${FG_RED}Filename ${1} does not exist${NORMAL}"
echo -e ${usage}
fi
file="${1}"
fixed="${1}.education"
backup="${1}.student"
sed 's,\(fileInfo "license"\) "student",\1 "education",' ${file} > ${fixed}
mv ${file} ${backup}
mv ${fixed} ${file}
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment